1
votes

I have heard of using LuaJIT to compile Lua code into bytecode and then into a static library.

Ideally I would want to be able to compile the Lua code into a dynamic library so I don't have to rebuild the main executable.

Can you compile Lua into a dll? If so how do you link it to c++ code since there's no headers? Finally how would you run the Lua scripts from inside the program?

1
"Ideally I would want to be able to compile the Lua code into a dynamic library so I don't have to rebuild the main executable." I don't understand how building Lua as a DLL has anything to do with rebuilding the main executable. How often are you recompiling the Lua library? Are you talking about the Lua interpreter or a Lua script? - Nicol Bolas

1 Answers

1
votes

I believe what you would do is link the lua interperter dll ( http://www.lua.org/pil/24.html ) to your program and then include the script as a resource such as in a header to your c/c++ program and use the lua.dll functions to execute it. Also you can call lua functions from C using that method( this shows a several complete snippet examples with header files http://www.troubleshooters.com/codecorn/lua/lua_c_calls_lua.htm ) .