9
\$\begingroup\$

I'm using Lua in my C++ program, as an library. But I read that LuaJIT is a better implementation.

Is it posible to replace with LuaJIT with little change? How?

\$\endgroup\$
4
  • 4
    \$\begingroup\$ Just replace the source files if you're compiling from source, or the DLL if you're using the precompiled one. LuaJIT is meant to be a drop-in replacement for stock lua, so it should work just by replacing it. \$\endgroup\$ Feb 19 '13 at 9:31
  • 4
    \$\begingroup\$ @PandaPajama that should probably be an answer, not a comment \$\endgroup\$
    – ashes999
    Feb 19 '13 at 11:44
  • \$\begingroup\$ It's not so simple on Mac OS X \$\endgroup\$
    – finnw
    Feb 19 '13 at 15:27
  • \$\begingroup\$ Here's a relevant email discussion about the pros/cons of various Lua implementations. \$\endgroup\$
    – Anko
    Feb 20 '13 at 10:34
5
\$\begingroup\$

Just replace the source files if you're compiling from source, or the DLL if you're using the precompiled one (preferred).

Per the Installation Guide:

LuaJIT is API-compatible with Lua 5.1. If you've already embedded Lua into your application, you probably don't need to do anything to switch to LuaJIT, except link with a different library:

LuaJIT is meant to be a drop-in replacement for stock lua, so it should work just by replacing it

\$\endgroup\$
2
\$\begingroup\$

As Panda Pajama comment suggest. It's easy a drop-in replacement.

  • Change include path to get LuaJIT lua.hpp file
  • Downgrade code from Lua 5.2 API to Lua 5.1 API.
  • Linked with LuaJIT library instead of lua library

The worst part was the downgrade to 5.1, specially the load of own function modules in lua State.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.