lua-users home
lua-l archive

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


Hi,

I'm trying to compile Lua on an AIX machine with luasocket statically
linked in, as I don't have dlopen there... but how do I convince the
module system that the ".so"s of luasocket are already loaded, and
what is the correct sequence of "require"s? The script that I am using
is below - I'm quite sure that I'm close to the solution, but my brain
is melting.

You can use the package.preload table for this.
Make sure you add an entry package.preload["socket.core"], whose value
is the C function (use lua_pushcfunction) luaopen_socket_core. Do the same with package.preload["mime.core"] and the function
luaopen_mime_core. When you call require(), it will not try to load the
shared library.

Regards,
Diego.