How to compile Lua scripts into a single executable, while still gaining the fast LuaJIT compiler?

Translate all of the Lua source code files to object files and put them in a static library: for f in *.lua; do luajit -b $f `basename $f .lua`.o done ar rcus libmyluafiles.a *.o Then link the libmyluafiles.a library into your main program using -Wl,–whole-archive -lmyluafiles -Wl,–no-whole-archive -Wl,-E. This line forces the linker to include … Read more

Why is LuaJIT so good?

Mike Pall has talked about this in a few places: http://article.gmane.org/gmane.comp.lang.lua.general/58908 http://lambda-the-ultimate.org/node/3851 http://www.reddit.com/user/mikemike As with every performant system, the answer in the end comes down to two things: algorithms and engineering. LuaJIT uses advanced compilation techniques, and it also has a very finely engineered implementation. For example, when the fancy compilation techniques can’t handle a … Read more