Löve is a simple and powerful framework for developing 2D games in Lua, which makes it a natural fit to support in ZeroBrane Studio. The just released version of ZeroBrane Studio (v0.30) implements debugging and auto-complete support for löve scripts; the video below demonstrates these capabilities (you may need to switch the video to 720p to make the text more readable):
To enable the integration shown in the demo, you need to do few things:
Copy the debugger ((This step is no longer needed if you use ZeroBrane Studio v0.31 or later)src/lualibs/mobdebug/mobdebug.lua) to the folder with löve executable (in the demo it isd:\lua\lovefolder).- Add
if arg[#arg] == "-debug" then require("mobdebug").start() endline to your script somewhere insidelove.load(arg)function. This will allow you to useProject | Runcommand to run the application andProject | Start Debuggingto debug your application. - Select love2d as an interpreter in ZeroBrane Studio going to
Program | Lua Interpreters | Love2d. In addition to enabling debugging, it will also turn on auto-complete for löve API calls. If löve executable is in the same folder where your game folders are or in one of the folders listed inPATH, it will be found by the IDE. If the executable is in a different location, you may need to specify this location incfg/user.luafile (seecfg/user-sample.luafor details on how this is done).
You can now open main.lua file from your project in the IDE and work with your creation.
How come when I use the debug tool it crashes love, and zbstudio.exe if i run the file in console to work out what's happening?
Not sure; is there anything I can try to reproduce? ZBS is usually resilient to app crashes as it runs in a separate process. What platform are you on? Is there a small project I can try on? Do you do anything in particular when it crashes? Do other scripts work? You can email me the details; my address is at the bottom of the page.
Paul.
@someone from Love2d.org: I may know what may be causing the crash. Try adding "socket.select = function() return {} end" after "require('mobdebug').start()".
One possible reason for the crash is that ZBS is using luasocket DLLs compiled using mingw compiler, but love2d is compiled using Visual Studio. I noticed that in some rare cases this mix causes a crash when socket.select call is used (which happens in the debugger). I'm exploring fixes for this issue.