lua-users home
lua-l archive

Re: requiring modules with a C and Lua part

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


Hi,
What's common practice in the case that a module has both a C and Lua component?
Is there a standard neat way out?
I don't know how common it is, but I love doing it.
LuaSocket, the MIME module, and LuaThread all do it. There
is a socket.lua file. This is what is require()d by the
user, so it is in the LUA_PATH. It in turn require()s
"socket.core". There is a core.so inside a socket/ directory
in the LUA_CPATH. Both export symbols into the socket
namespace.
There might be better ways, but this has worked well for me.
[]s,
Diego.

AltStyle によって変換されたページ (->オリジナル) /