[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Packing Lua-interpreter and modules into one library
- From: Wolfgang Pupp <wolfgang_pupp@...>
- Date: Sun, 12 Apr 2009 08:56:35 +0000 (GMT)
I'm currently trying to merge interpreter (LuaJIT) and some modules (lpeg, lfs, md5) into one library (a windows DLL, using MinGW).
My (quite naive) approach is to compile the C- based part of the modules into object files and to link them with the interpreter's object files.
I intended to just wrap the Lua- code in some luaL_dostring- commands (is there any better way? I once ran across a LuaToC- converter, but that one only worked for Lua 4.x).
The problem arises with the loading of the modules- I assume that it would be best to set the corresponding entries of the package.preload- table, because that way, 'require' would still work as expected.
But where to change the preload- table? I suppose that I have to edit one of the interpreters source- files, but which one? Is there any designated function stub/... for changing the preload- table?
If there is a better way to do this, or if there exists already some script/tool/etc. which does something like that (merge interpreter and modules, or convert Lua- to C- code) please point me at it!
thanks in advance,
Wolfgang