What it is
This is a MetaLua (their current repo) preprocessor, allowing you to use macros and other compile-time metaprogramming techniques in your LÖVE code. For example, if you were ever irked by the lack of the += operator and its relatives, now you have them, right out of the box.
Please keep in mind that it is Windows only for now, and comes with LÖVE built with Lua 5.1 due to the current limitations of MetaLua.
Where to get it
If you already have Lua 5.1 with LuaRocks installed, you can get it by executing
Code: Select all
luarocks install love-preprocessor-cli --server=https://dl.dropboxusercontent.com/u/762468/Lua/rocks
How to use it
This gives you the lovepp command. Currently the usage is just
Code: Select all
lovepp <command> <project directory>
- new: creates a skeleton of a new project
- compile: translates all MetaLua code to Lua bytecode, giving you a directory that you can feed to LÖVE
- run: runs compile and launches the result using its internal version of LÖVE
- pack: produces a .love file
- deploy: creates an exe and zips it together with all relevant dlls
Why it exists
This is a part of ongoing work to create an object model specifically suited for game development: taking advantage of the things specific to it (such as the existence of the main loop) and easing code reuse. This is made possible by pretty involved processing of the code the game developer wrote, which requires representing code as data AND pushing said processing out of the runtime and into a separate "compilation" step. MetaLua answers both these needs (read: I tried to do without, and the result wasn't too pretty).
For example, many classes have an update method (and classes are an obvious choice for code reuse), which raises the problem of call order. Rather than specify it manually (which conflicts with reusability) I give each such method a set of tags and allow the definition of ordering constraints based on these tags. Most of these tags are best off automatically generated based on the method's source, and that requires a code walker, another tool MetaLua readily provides.