lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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