[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua Lanes with package.preload and package.loader
- From: Greg <tghill@...>
- Date: Fri, 18 Nov 2011 00:56:04 +0000 (UTC)
Benoit Germain <bnt.germain <at> gmail.com> writes:
> Without changing Lanes, the solution is to have your C code invoked in
> the target lane so that the library is registered there, and to remove
> references to these functions in the lane body, by eliminating the
> upvalues that reference them.
I've made some progress. I simply wrap the c_functions in lua_functions.
local my_c_function = package.preload["socket.core"]
package.preload["socket.core"] = function()
return my_c_function()
end
local lanes_loader = package.preload["lua51_lanes"]
package.preload["socket.core"] = function()
return lanes_loader()
end
Now I am getting another error:
bad argument #-10003 to 'configure' (string expected, got number)
It is from lanes.c:2341
LUAG_FUNC( configure )
{
char const *name = luaL_checkstring( L, lua_upvalueindex( 1));
int const nbKeepers = luaL_optint( L, 1, 1);
...
Where is upvalue 1 set? Is this the upvalue I should be eliminating?
Thanks!
- Greg