lua-users home
lua-l archive

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


Hi,
I would like to open a new thread, then invoke a Lua-function and then kill the thread again.

But after some invocations of this, the invocation of api_incr_top(L) in lua_newthread runs into assert concerning some stack error.

The the lua_State pointer element "top" increases every time quite a bit.

I tried the following C code:

lua_State* LuaBase= luaL_newState();
luaL_dofile( LuaBase, "test.lua");
for( int i= 0; i< 100; i++){
  lua_State* L= lua_newthread( LuaBase);
  lua_resetthread( L);
}

If I watch LuaBase->top in this for loop, it will increase and increase. Is there some recommended way to avoid this? (thus to somehow "remove the new thread" again completely?).