Keep folder loaded on error

Currently if a lua error occurs I'll attempt to fix it and then have to re-open the build folder in the simulator. Then it crashes because I fixed it wrong so I try again and have to go to the folder again etc. It'd be nice if there was either an option or default behaviour to keep the same folder loaded when an error occurs. Another option would be to have a button to open the previous folder so the sdk still goes back to the settings but can then be easily restarted to the build folder. For now I think I might end up wrapping my whole game in a catch just so I don't have to keep restarting with every typo

I'm not sure what coding environment you're using, but our Playdate extension for Nova solves this with a Run task that automatically relaunches your game in the simulator after it builds.

If you aren't able to use Nova, you can use a build script that opens your game in the simulator:

  • Mac: open mygame.pdx
  • Windows: \path\to\PlaydateSDK\bin\PlaydateSimulator.exe mygame.pdx

There's a problem on Windows, though: this command will open a second copy of the simulator instead of reloading your game in the existing one. We're working on a fix, but for now, you can add a command to close the open simulator before launching the new one:

taskkill /IM PlaydateSimulator.exe
\path\to\PlaydateSDK\bin\PlaydateSimulator.exe mygame.pdx

I'm on Linux but it sounds like the same as on windows. I can write a script to fix it like you suggest but ideally the root of the issue would fixed (so a Lua error doesn't unload the game)