Debugging LUA How is it done?

Is there a way to debug ArduPilot Lua scripts as it seems that you would need the scripting debugging program running on your PC to be also connected to Pixhawk and a RC radio?? Or is there a console that simulates the Pixhawk? In other words how is it done?

Load up a script and look for the errors in the messages tab.

There are also online lua tools that can be use to debug generic lua, but not the ArduPilot specific bindings.

I’m using ZeroBrane Studio and it will give errors related to the devices that are not connected e.g.
lua:36: attempt to index global ‘SRV_Channels’ (a nil value)
As a novice coder I am used to a debugger allowing you to see if the code works e.g. write to a file.
Is there a work around something like this with LUA?

You can use the built in REPL.

You can run scripts and the REPL in SITL, you can run this directly from mission planner.

Hi Peter
Thanks for the link it looks like what I was looking for.

Hi Peter
Looks like some great additions on the way!
The steps in the video are a little difficult to follow and I ask if there is some more information available on FTP and REPL?

Sorry, there is not a huge amount of documentation on this, first step is probability to get the latest beta of mission planner. HELP -> Check for beta updates.

You can then find the FTP and RELP tabs in the setup and config menus.

I understand the documentation situation and thanks for providing a starting point!