Re:Compiling to Lua
by burntsushi on Saturday August 24, 2013 @12:10AM
(#6267572)
Have you heard of Terra[1]? I think it was pretty much designed for what you're saying. :-)
The cool thing is that the project looks really active too.[2]
[1] - http://terralang.org
Many people "compile to C" if they just want to write some personal toy language or an experimental language. I think "compile to Lua" would be a superior alternative in many cases.
One should point out that this way you get an incremental garbage collector for free, one whose behavior can easily be controlled at runtime i.e. good for soft real-time applications (e.g. games).
Also both Lua and LuaJIT are very lightweight which means you can simply bundle the complete language implementation when creating standalone binaries. On Windows x86 Lua5.1 is ~308kb compiled, LuaJIT2 ~340kb.