I am aware of Playdate.exit() / playdate->system->exit() - #3 by NaOH , but it is marked as resolved, so opening a new thread here. But let me know if I should have added to that thread
I am a maintainer of a Zig binding for the Playdate API: GitHub - DanB91/Zig-Playdate-Template: Starter code for a Playdate program written in Zig · GitHub
Zig has a concept of a panic handler, which is never returns. Before SDK 3.0, this worked perfectly with playdate→system→error() since error() would immediately exit the game. After 3.0, error() now returns instead of quitting the game. As such, there is currently no way to cleanly exit the game from the panic handler. So there are 2 options, both of which aren’t ideal:
- Have the panic handler hang, which freezes the Playdate simulator
- Embed a breakpoint, which crashes the simulator.
I've currently opted for the latter since at least with a breakpoint, you can catch that in the debugger. In both cases, the error passed into error() is never printed to the console, like it was prior to 3.0.
I’ve tried playdate→system→restart() as suggested in the other thread, but this also returns like error(), so it doesn’t help here.
An exit() API that quits the game immediately, would be perfect in this situation.
Please let me know if I am missing something here. Thanks!