LuaJIT and Rocks?
Asked Answered
C

2

6

Just a small question from a "Lua newbie"...I have been using LuaJIT and it is awesome, no the question is since LuaJIT is Lua 5.1 compatible does that mean I can use all the "LuaRocks" that standard Lua uses in LuaJIT?

For instance if I wanted to install one of the SQLite libraries (e.g. http://luaforge.net/projects/luasqlite/) - how would I install that in LuaJIT?

Do all the available "LuaRocks" work out the box with LuaJIT?

Caracul answered 30/6, 2011 at 18:10 Comment(0)
M
9

LuaJIT is designed to be drop-in compatible with the Lua stand-alone. There is no reason why any purely Lua-based Rocks shouldn't work. DLL-based Rocks ought to work as well, since the LuaJIT stand-alone DLL is compatible with the original DLL.

Mopboard answered 1/7, 2011 at 0:39 Comment(3)
Second that. I tried replacing a stock Lua interpreter by LuaJIT in a rather involved project with bunches of rocks (using the Kepler Project) of which quite a few C-rocks, and it worked instantly. Whether all rocks work, I can't tell you.Veradi
Probably the ones relying on lua's bytecode won't work, as that bytecode is not compatible with luajit's one (recently implemented). There might be other little differences. I myself am luajit-er, and enjoy it immensely. All my bindings are done through the FFI, rather than the standard lua api binding mechanism.Clubbable
@malkia: not recently implemented, but recently documented. LJ2 always had the bytecode.Jampan
G
0

Concretely:

"LuaJIT is fully upwards-compatible with Lua 5.1. It supports all standard Lua library functions and the full set of Lua/C API functions. LuaJIT is also fully ABI-compatible to Lua 5.1 at the linker/dynamic loader level. This means you can compile a C module against the standard Lua headers and load the same shared library from either Lua or LuaJIT."

I think that pretty much says it all.

Glue answered 23/1, 2012 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.