Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
4  
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. –  Panda Pajama Feb 19 '13 at 9:31
4  
@PandaPajama that should probably be an answer, not a comment –  ashes999 Feb 19 '13 at 11:44
    
It's not so simple on Mac OS X –  finnw Feb 19 '13 at 15:27
    
Here's a relevant email discussion about the pros/cons of various Lua implementations. –  Anko Feb 20 '13 at 10:34
add comment

2 Answers

up vote 4 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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