lua-users home
lua-l archive

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


You can use lua_gettop to know the size of current stack.
use lua_checkstack to allocate more slots in the stack.

Generally speaking, the stack will not overflow unless you make some mistake.

http://www.lua.org/manual/5.1/manual.html

is the official document about every functions, you can find anything you want there.:)


----- Original Message ----- 
From: "Steve Heller" <steve@steveheller.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Tuesday, September 12, 2006 9:42 AM
Subject: Re: Problem with table created from C


On Tue, 12 Sep 2006 09:02:52 +0800, "jason zhang"
<jzhang@sunrisetelecom.com.cn> wrote:

>From Lua 5.1 manualvoid lua_settop (lua_State *L, int index);Accepts any acceptable index, or 0, and sets the stack top to this index. If the new top is larger than the old one, then the new elements are filled with nil. If index is 0, then all stack elements are removed. 
>
>Why call lua_settop(L,0) ?

To clear any stack entries I don't need. I couldn't find documentation
on how each function affected the stack, so I decided to clear it
after I used it to make sure I didn't have an overflow. Apparently
that isn't a very good idea.

Steve