Decoda is a nice IDE for Lua that is capable of debugging MCServer plugins while MCServer is running. This enables you to set breakpoint, inspect variable values etc. Note that the IDE is currently Windows-only.
To set up, you need to download and install Decoda:
http://unknownworlds.com/decoda/
If you don't compile MCServer yourself, and rather use the nightbuilds, you need to download the PDBs (at the nightbuild server, in the PDBs folder) and extract MCServer.pdb from there next to the MCServer.exe.
Start Decoda. Either open an existing project (for built-in plugins), or create a new project file (Project -> New Project), add your plugin files to it (Project -> Add existing files).
In both cases, you need to set up the project debugging options before running for the first time. Go to Project -> Settings. In the Command box, enter the full path to MCServer.exe (you can use the triple-dot button to browse for the file). The Working directory box will be filled with the folder in which MCServer resides, keep that value.
Click OK and you're done.
Save the project file (Project -> Save project).
Now you can edit the plugins in Decoda, and debug them at the same place.
To run the debug session, press F5 (Debug -> Start debugging). Decoda will run MCServer. Don't forget to enable your plugin in MCServer settings.
Now you can set breakpoints in the code (F9), and once they get hit, you can step to next command (F10) or step into a function call (F11); you can view variable contents by hovering mouse over them, or entering the variables into the Watch window.
Final notes:
- Decoda stores project in two files. The .deproj file stores files in the project, while .deuser stores the debugging settings. You can commit the .deproj file to your version-control system, but it's a bad idea to commit the .deuser file there, because it lists absolute paths, unusable on other people's computers
- When MCServer starts, Decoda adds all plugins' Lua files to the project temporarily; the ones added are grayed out. You can use those files in the same way as project files, setting breakpoints and inspecting variables, but all such files will be removed again as soon as MCS stops.
- You can use either the MCServer.exe or MCServer_debug.exe (produced by VS in debug builds) for Decoda debugging; both do work.
To set up, you need to download and install Decoda:
http://unknownworlds.com/decoda/
If you don't compile MCServer yourself, and rather use the nightbuilds, you need to download the PDBs (at the nightbuild server, in the PDBs folder) and extract MCServer.pdb from there next to the MCServer.exe.
Start Decoda. Either open an existing project (for built-in plugins), or create a new project file (Project -> New Project), add your plugin files to it (Project -> Add existing files).
In both cases, you need to set up the project debugging options before running for the first time. Go to Project -> Settings. In the Command box, enter the full path to MCServer.exe (you can use the triple-dot button to browse for the file). The Working directory box will be filled with the folder in which MCServer resides, keep that value.
Click OK and you're done.
Save the project file (Project -> Save project).
Now you can edit the plugins in Decoda, and debug them at the same place.
To run the debug session, press F5 (Debug -> Start debugging). Decoda will run MCServer. Don't forget to enable your plugin in MCServer settings.
Now you can set breakpoints in the code (F9), and once they get hit, you can step to next command (F10) or step into a function call (F11); you can view variable contents by hovering mouse over them, or entering the variables into the Watch window.
Final notes:
- Decoda stores project in two files. The .deproj file stores files in the project, while .deuser stores the debugging settings. You can commit the .deproj file to your version-control system, but it's a bad idea to commit the .deuser file there, because it lists absolute paths, unusable on other people's computers
- When MCServer starts, Decoda adds all plugins' Lua files to the project temporarily; the ones added are grayed out. You can use those files in the same way as project files, setting breakpoints and inspecting variables, but all such files will be removed again as soon as MCS stops.
- You can use either the MCServer.exe or MCServer_debug.exe (produced by VS in debug builds) for Decoda debugging; both do work.