ZeroBrane Lua IDE Setup
ZeroBrane Studio is a Lua IDE, which allows you to debug Lua code. You can set break-points, go through code step-by-step etc. You can watch an example of it in action here.
ZeroBrane also has an auto-complete feature:
To use ZeroBrane with Pragma, you have to follow these steps:
- Download ZeroBrane Studio from https://studio.zerobrane.com/ and install it into a directory of your choice, then start it.
- Select "Project/Project Directory/Choose..." from the ZeroBrane menu bar, and nagivate to your pragma installation, and select it. Do not choose a sub-directory, otherwise the debugger may not find some Lua-files.
- Copy all files and directories from "pragma/sdk/ZeroBrane" to the ZeroBrane installation directory
- Select "Edit/Preferences/Settings: System" from the menu bar, and add the following line to the end of the file:
- Restart ZeroBrane after saving the file.
- Select "Project/Lua Interpreter/Pragma" from the menu bar
With that, you should now be able to use the auto-complete feature. Setting up the debugger requires some additional steps.
- Run "Project/Start Debugger Server" from the menu. You will have to do this every time after starting ZeroBrane and before starting a game in Pragma.
- Add "-luaext" to the launch parameters of Pragma. Doing so should add a red "[D]" next to the version on the bottom right when starting Pragma.
- Launch Pragma, but don't load a map yet.
- Set the console variable "sh_lua_remote_debugging" to "1" if you want to debug serverside, or "2" if you want to debug clientside ("0" to disable debugging). You have to make this choice before loading a level.
- Open a Lua-file. Any Lua-file will do, but it has to be contained somewhere in the Pragma installation. If you don't have at least 1 Lua file from the project opened, the debugger will not work.
- Load a map. The "Output" window of ZeroBrane should say something along the lines of "Debugging session started", which means the programs are connected successfully. If so, Pragma should have paused in the background, and you should be able to see these icons in the menu bar of ZeroBrane:
- You can now open up Lua-files in ZeroBrane and start Debugging!
Important: Make sure to remove the "-luaext" launch parameter after you've finished debugging! The parameter enables several Lua-modules which can be abused by malicious addons, or if you're playing on an untrusted server! These modules are required for remote debugging only!