[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: luajit2 head and Lanes 2.07, very strange!
- From: Benoit Germain <bgermain@...>
- Date: Tue, 30 Nov 2010 15:20:41 +0100
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of zhiguo zhao
> Sent: Tuesday, November 30, 2010 2:52 PM
> To: Lua mailing list
> Subject: luajit2 head and Lanes 2.07, very strange!
> Hi, man in lua.
> Why I first require lanes failed, but it works after call tostring?
Not sure the second require works. Maybe the module is already registered despite the error and the second call does nothing?
> Any one can say it! Thanks.
I see this in the Lanes code:
void luaG_inter_copy( lua_State* L, lua_State *L2, uint_t n )
{
uint_t top_L= lua_gettop(L);
uint_t top_L2= lua_gettop(L2);
uint_t i;
/* steal Lua library's 'luaB_tostring()' from the first call. Other calls
* don't have to have access to it.
*
* Note: multiple threads won't come here at once; this function will
* be called before there can be multiple threads (no locking needed).
*/
if (!hijacked_tostring) {
STACK_GROW( L,1 );
STACK_CHECK(L)
lua_getglobal( L, "tostring" );
//
// [-1]: function|nil
hijacked_tostring= lua_tocfunction( L, -1 );
lua_pop(L,1);
STACK_END(L,0)
if (!hijacked_tostring) {
luaL_error( L, "Need to see 'tostring()' once" );
}
}
Now, this error isn't raised using the stock Lua VM, so I can't say what is happening with LuaJIT.
Benoit.