I wrote a script which helps to write lua code in an external editor. The script listens to changes in the .lua file and re-integrates the lua code back into the .p8 cartridge. Each time you save.
So you can happily change lua files and edit assets in Pico-8 and everything gets merged back as soon as you save. Write some code in your editor, switch to Pico-8 and press ctrl-R to reload. It's quick :)
Works great for me in Intelij Idea, where I have syntax highlighting, code analysis and code completion. When trying to call a function, the IDE even shows the function parameters and lua-doc. What more can you ask for?
Some other things the script can do for you
- include library code (#include library)
- remove debug code on release (#define debug, #if debug, #end debug)
- strip comments if you hit the size limit (please consider that comments are helpful for the Pico-8 community ;))
- convert pico-8 specific statements like += to plain .lua. Some IDEs might work better with plain lua.
That's it, hope you like it. Download it here:
Have a look in the python file, there is more detailled und up to date instructions on the features.
PS: one down side though: the script works for Linux only at the moment, since it uses pyinotify for getting notified about file changes. I'm happy to accept pull requests if you want to port it to windows, maybe doing polling on the .lua files.
Watchdog does cross-platform file watch notifications. I've used it for stuff, though I haven't tested it on Windows.
picotool can build .p8 and .p8.png files from multiple files, including folding a Lua source file into an existing cart with images, etc. I'll add a feature request for a watch mode, good idea!
[Please log in to post a comment]