Can MetaLua be used with LuaJIT?
And if it so, then how?
(I couldn't find any reliable info)
The Metalua compiler appears to be written in Lua and Metalua, so theoretically yes. The makefile reveals some of the interesting core pieces. Metalua itself appears to run on top of Lua.
cat > ${BUILD_BIN}/metalua <<EOF
#!/bin/sh
export LUA_PATH='?.luac;?.lua;${BUILD_LIB}/?.luac;${BUILD_LIB}/?.lua'
export LUA_MPATH='?.mlua;${BUILD_LIB}/?.mlua'
${LUA} ${BUILD_LIB}/metalua.luac \$*
EOF
However, LuaJIT isn't capable of compiling multiple scripts into one output file at the command line like LuaC. Simply replacing LUAC
with an instance of LuaJIT won't do. The following lines will have to be adjusted for a LuaJIT-compatible makefile.
${LUAC} -o ${BUILD_LIB}/metalua/bytecode.luac lopcodes.lua lcode.lua ldump.lua compile.lua
${LUAC} -o ${BUILD_LIB}/metalua/mlp.luac lexer.lua gg.lua mlp_lexer.lua mlp_misc.lua mlp_table.lua mlp_meta.lua mlp_expr.lua mlp_stat.lua mlp_ext.lua
Unfortunately, that issue pales in comparison to the contents of some of the files that get compiled into bytecode.luac
, considering that they reference PUC-Lua opcodes and bytecode, which are definitely incompatible with LuaJIT.
I'd say that if it is possible, then it would certainly require some reprogramming of the compiler, but out-of-the-box usage with LuaJIT is highly unlikely.