lua-users home
lua-l archive

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


 > > These days I frequently find myself wanting to create a Lua module
 > > that is part C code and part Lua code.  The 'module' and 'require'
 > > functions seem to be set up to support one or the other, but not
 > > both in combination.
 > 
 > Here is what I do with LuaSocket.  I put the C functionality
 > in socket/core.so. The Lua functionality is put in
 > socket.lua. When the user runs require"socket", the Lua file
 > is invoked. This, in turn, runs require"socket.core", which
 > loads the C functionality. After that, the Lua module runs
 > module"socket". 

I've thought of a snag.  I want to deploy a package in my home
directory that will run both on the mail server (x86-bsd) and on my
desktop (x86-linux).  These two systems cannot share .so files.
So I may be reduced to using package.loadlib after all :-(


Norman