[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lua_checkstack in Lua 5.0
- From: "Bilyk, Alex" <ABilyk@...>
- Date: Mon, 9 Jun 2003 20:41:00 -0700
Hi all,
lua.c defines a function for opening all standard libraries. Here is the body
static void openstdlibs (lua_State *l) {
const luaL_reg *lib = lualibs;
/*lua_checkstack(l, 1000); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
for (; lib->func; lib++) {
lib->func(l); /* open library */
lua_settop(l, 0); /* discard any results */
}
}
I added the line marked by'<<<<...'. Uncommenting this line leads to a failed assert in traversestack() (line:245 / lgc.c) while still in openstdlibs above. Basically, growing Lua stack to a much larger size than what Lua creates by default causes some kind of a problem. Is this a problem indeed or am I misusing lua_checkstack? Could you verify this on your machine? Before you start you will need to define lua_assert to actually do something, as by default it is defined to do nothing.
According to documentation lua_checkstack grows Lua stack to be no smaller than the size specified (1000 in the above case). Apparently it has the above side effect in addition to growing the stack.
Thanks,
Alex