Using breakpoints with LUA code

Is it possible to set breakpoints in LUA example code projects? I'm pretty new to LUA development and I'm not sure what IDE to use and how to start debugging LUA code.

Thanks!

It's possible using Nova on macOS, I tried it briefly during a beta test. But, that's as much as I can say about it.

1 Like

That's for C debugging is it not. The poster was asking about Lua debugging.

I'm starting to get the impression that nobody is using Lua for development much.

What gives you that impression @rols ?

I for one use Lua exclusively, just without proper debugging or breakpoints. Yes, it's not ideal.

Multiple season one games are written in Lua.

oh it was mostly that I have seen many more questions about C and C APIs and how to write in C than I have about Lua. Perhaps the dev boards however aren't representative of all the work which is going on and most people just use the SDK the way it came and don't have a ton of questions.

It would be useful to have first class debug. I was intrigued by your earlier comment that it worked in Nova, to the point I thought it would be worth buying Nova if that were the case. Perhaps I'll try the free trial and see if I can make that work. I was a bit surprised given that IDE-based debugging now is pretty much a solved problem that everyone here is doing printf debugging for Lua development.

I'll admit my temptation at this point is to write in C just because of the debugability.

I'm currently developing my first game in Lua and I can get by not using the debugger. Having said that as the game becomes more complex, I have a feeling that I'll eventually wish I had one.

I'm currently using the Linux variant SDK with VSCode.

@matt @rols looking around the forums on the topic of Lua debugging (and debugging in general), it seems to be only exclusive to Nova, a MacOS only IDE.

Is switching to Windows my only option for debugging? I have seen some tutorials and setups, but haven't seen anything close to what OP is asking.

Yes the only debugging anyone seems to have been able to do is in Nova which has/had hooks for it. However if you flip over to this thread How to invoke the Debugger? - #8 by matt you can see matt has kindly responded that debugging will be in the NEXT version of Nova (which means I just blew my free 30 day trial sob sob). So i don't think there's a way to debug Lua for playdate at all on any platform at this point.

At the point that Nova support for it comes out I'm hoping there will be enough documentation about the hooks for someone to write quick vscode extension for this as well.

1 Like

I’m developping my game with Lua. I’m using the Nova beta for breakpoints and debugging and it works well for me so far. There used to be a link toward a beta version of Nova here but I can’t find it anymore. I was confirmed some time ago that breakpoints and debugger only works on the beta, not the regular version.

1 Like

Nova 9 is now out, with debugging support.

1 Like

.. and works exactly as you'd hope. Thanks very much. So now we have a way to debug Lua on MacOS at least (which works for me). I will ask if the debug API might make it into documentation one day so that perhaps a debug module could be written for vscode.

1 Like

I suspect next public SDK will have updated docs.

I will ask if the debug API might make it into documentation one day so that perhaps a debug module could be written for vscode.

The Playdate Simulator responds to the Debug Adapter Protocol.

Here's a Playdate debugger extension for VS Code I hacked together last night: Playdate Debug - Visual Studio Marketplace

There are currently a couple known issues that I am still trying to sort out:

  • VS Code continues to display a progress bar after connecting to the debugger. The progress bar goes away after a breakpoint is hit.
  • An error message is displayed after clicking the stop button the first time. Clicking the stop button a second time correctly stops the game in the Simulator. Alternatively, hold the alt/option key when clicking the stop button to change it to a "disconnect" button.
6 Likes

I've been using Lua debug with the beta for quite some time now and it works well. So I assume Nova 9 should be even better. Time to switch out from the beta branch!

2 Likes

Looks like the VSCode debugger extension does not work on Windows at the moment.

Panic devs, does the Playdate Simulator run the Debug Adapter Protocol on Windows/Linux?

I've tried extension in Ubuntu @midouest. Working nicely :playdate:, minus the debugging as stated :playdate_dizzy:.

Any update on this?

1 Like

Only the Mac Simulator supports the Debug Adapter Protocol at the moment. It is on my to-do list to get it into the Windows and Linux sim soon.

4 Likes

Is it already in 11.0 SDK?

Sorry to bother, but any update on this?

I stopped developing a couple of months ago, primarily because I didn't want to deal with hacking my code and adding on console print lines instead of using a proper debugger.

Surfing the forums I can't see if it's been implemented.

@IGM0937 I'm actively working on this and hopefully will make it into the next release, thanks for your interest!

7 Likes