This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kees987's profile picture

Simulate and/or Debug (without starting MC)

Started by Kees987, 23 October 2013 - 05:55 AM
Kees987 #1
Posted 23 October 2013 - 07:55 AM
Title: Simulate and/or Debug (without starting MC)

I was wondering of there is a way to test/simulate/debug your lua scripts without having to start MC/ftb ?
The reason for this would be that i love working on my script, but dont have FTB on all of my computers.
My laptop is relative old, so it cant run FTB, but i like working on my script when im on that laptop.
During the work on that, i would like to test run the script and see of there is already errors popping up.

Is this possible in some way, i do i really need to start MC/ftb to test the script?
Engineer #2
Posted 23 October 2013 - 09:48 AM
Use CCDesk
However its a simulator, you might still get a different result in-game. But that chance is very, very small.
TheOddByte #3
Posted 23 October 2013 - 09:50 AM
Well you can get and emulator that you can use, Either CCEmu or CCDesk that I know exist ( Or do they? :P/> )

Edit: Damn ninjas .-.
theoriginalbit #4
Posted 23 October 2013 - 10:01 AM
Definitely avoid CCEmu. Its is discontinued and no longer supported, CCDesk is still currently being developed. Now as for something neither of these two mentioned, CCDesk does not support Turtles (yet?), so if its a Turtle script you'll still have to boot up Minecraft.
AgentE382 #5
Posted 24 October 2013 - 08:53 PM
If your laptop is too old to run CCDesk, try this: http://www.computercraft.info/forums2/index.php?/topic/13445-lightweight-cc-emulator-download-now/

It's not as good, but it's passable if you've got older hardware.
w1zzard #6
Posted 25 October 2013 - 03:41 AM
http://codepad.org/ could work too. wont tell u if ur code is doing what u want it to tho, only error msg's that ud get from running it
theoriginalbit #7
Posted 25 October 2013 - 04:38 AM
http://codepad.org/ could work too. wont tell u if ur code is doing what u want it to tho, only error msg's that ud get from running it
Problem with that being is its designed for Lua, there are many functions in Lua that are not present in CCLua, and similarly there are myriads of functions added into CCLua that are not in Lua. Therefore just a standard Lua compiler/VM will not suffice for testing CCLua scripts.
Engineer #8
Posted 25 October 2013 - 09:39 AM
Problem with that being is its designed for Lua, there are many functions in Lua that are not present in CCLua, and similarly there are myriads of functions added into CCLua that are not in Lua. Therefore just a standard Lua compiler/VM will not suffice for testing CCLua scripts.

Actually, you can compile your lua code just with the standard luac.exe
It will give no compile error as long as you use vald CC API calls, otherwise your program will result in a runtime error
theoriginalbit #9
Posted 25 October 2013 - 10:13 AM
Actually, you can compile your lua code just with the standard luac.exe
It will give no compile error as long as you use vald CC API calls, otherwise your program will result in a runtime error
I wasn't talking about luac.exe, I wasn't even talking about a compiler, of course the compiler would have no problems with CC Lua, unless there is syntax errors. But a lot of errors people get are in runtime, as well as compile time, and the link that w1zzard posted was codepad.org which not only compiles code, but it runs it too.
Really a compiler check is pointless for CC Lua scripts you're always better to run them and check for runtime errors. Just as a little extra, go to codepad.org copy/paste a CC Lua program into it and hit run (making sure you click Lua) … Here's a test that I performed, scroll to the bottom and you'll notice the error, codepad.org definitely cannot handle CC Lua scripts!
Engineer #10
Posted 25 October 2013 - 10:38 AM
Actually, you were talking about that a nano-second in your previous post. I wanted to say that for that:
Therefore just a standard Lua compiler/VM will not suffice for testing CCLua scripts.

However, if try to run a CCLua script, yeah, you are pretty much screwed. I know that, just because those API's arent in the standard global table.
I really was hitting about that compiler :P/>

Lets say I just wanted to note that you can compile CCLua, but just not run it without a custom global table that includes all CC API's