Live development environment for Love2d.
- Make sure Love2d is in $PATH (try
brew cask install love
) - Download the VSIX package file from the Releases tab
- Install it in VS Code from the Extensions side-tab's "..." button
Add this to your Love2d's main.lua file as early as possible:
require('live2d')
require('live2d.magictables') -- optional but useful
Now these keyboard shortcuts are enabled:
(Windows)
- Alt+Shift+R - Run Love2d
- Alt+E - Eval selection (whole file if no selection)
- Alt+Shift+E - Eval open files
- Ctrl+Shift+E - Eval current line
- Ctrl+Alt+E - Eval prompted string
(Mac)
- Cmd+Shift+R - Run Love2d
- Cmd+E - Eval selection (whole file if no selection)
- Cmd+Shift+E - Eval open files
- Ctrl+Shift+E - Eval current line
- Ctrl+Cmd+E - Eval prompted string
The magic tables is optional but it's super helpful in this context. Imagine you wrote a file that defines a new table, adds stuff to it, and uses it. (This is especially common when using tables as namespaces.) Once you use Live2d to re-eval that file, it's going to redefine that variable with a new table, and the old table will be inaccessible, with all its state!
Magic tables are just tables where any time you access a non-existing key that starts with an uppercase letter, it adds a magic table to that key and returns it. Which means this is recursive. The require statement above turns the global table into a magic table, so you can start accessing non-existing capitalized global variables, and they'll just come into existence!
There's an opt-in setting for "eval file on save" but its utility is questionable.
$ npm install
$ npx vsce package
- Initial release