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?

Lynton Grice
  • 1,435
  • 3
  • 29
  • 45

2 Answers2

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 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. – jpjacobs Jul 01 '11 at 07:35
  • 2
    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. – malkia Jul 21 '11 at 19:19
  • 1
    @malkia: not recently implemented, but recently documented. LJ2 always had the bytecode. – Alexander Gladysh Jul 26 '11 at 04:53
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.

Valeriu Paloş
  • 3,459
  • 1
  • 20
  • 12