Hello Guest it is December 15, 2019, 08:48:42 AM

Author Topic: Debugging Lua code...  (Read 1272 times)

0 Members and 1 Guest are viewing this topic.

Re: Debugging Lua code...
« Reply #10 on: March 13, 2018, 12:43:21 PM »
When I try "Operator -> Open Script Editor" and open script, then inst return non 0 (2304), but other functions still return -17
Re: Debugging Lua code...
« Reply #11 on: March 13, 2018, 12:47:49 PM »
from modules directory mcErrorCheck.lua

  • = 'MERROR_NOERROR',
Re: Debugging Lua code...
« Reply #12 on: March 13, 2018, 12:51:16 PM »
I understand this, but now I have MERROR_API_INIT as result code. Debugging was fine with mcLuaEditor, but with ZeroBrainStudio from latest releases - something wrong.
Re: Debugging Lua code...
« Reply #13 on: March 13, 2018, 01:18:43 PM »
from modules directory mcErrorCheck.lua

[ 0] = 'MERROR_NOERROR',

According to the API docs mc.mcGetInstance() does not return an error value, only a handle value. In this case it being zero is a problem and really does suggest that something was done out of order or not at all with how the code was run.
I'm not a complete idiot...
    there are some parts missing.
Re: Debugging Lua code...
« Reply #14 on: March 13, 2018, 01:21:59 PM »
Final problem description:

* Open "Operator -> Open Script Editor" and open script
* run or debug any simple script
* mc.mcGetInstance return 2304
* any other function return mc.MERROR_API_INIT
Re: Debugging Lua code...
« Reply #15 on: March 16, 2018, 12:06:49 AM »
Steve (aka Smurf), I am running my debugging session on a ZeroBrane session I started by hand with debug server running. I have also enabled multiple ZB instances so I can continuously edit my module code that supports my custom screen set. As expected, additional ZB instances are started as I need to edit screen element events, etc. I make my changes and exit out, leaving my first debug server session running - just fine.

It's a bit annoying to have to start and close the screen editor in order to debug the ScreenScript at startup. Is it possible to add a button to the Operator list that simply restarts/re-initializes the Mach engine so that the ScreenScript gets ran again without having to start and stop the screen editor? It might be wise to tie it explicitly to the Mach4GUI debug flag (-d) being passed at startup and only show it in debug mode.

I notice I can be in debug mode and running the screen set (aka not in the screen editor) and hit the "Break execution..." button on the debug server and that will drop me in to the debugger at some random point that was executing. But it would be nice to explicitly restart the ScreenScript without the over head of the screen editor.


-Freeman
I'm not a complete idiot...
    there are some parts missing.