lua-users home
lua-l archive

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


>> However, I have not seen anything in the Lua reference manual as to 
>> check the current stack size. The closest email I've found in the 
>> archives is http://lua-users.org/lists/lua-l/2002-
>> 09/msg00163.html, but that doesn't really help me with stack overflow 
>> checks.
>
>it's instructive to read the entire thread starting at that message:
>it mentions lua_checkstack() and luaL_checkstack().  also see section
>3.2 (The Stack and Indices) in the reference manual.

If you're into alternative Lua distributions, LuaPlus's LuaObject
(http://wwhiz.com/LuaPlus/index.html) almost completely eliminates Lua stack
management under C++.  In addition to that basic functionality, it
implements a solution similar to the one described in the above thread and
autoexpands the stack as needed.

If you're not into non-mainstream Lua distributions, you'll just have to
follow the lua_checkstack() approach above.

Josh