[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Problem with table created from C
- From: "jason zhang" <jzhang@...>
- Date: Tue, 12 Sep 2006 10:41:23 +0800
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.
is the official document about every functions, you can find anything you want there.:)
----- Original Message -----
From: "Steve Heller" <firstname.lastname@example.org>
To: "Lua list" <email@example.com>
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"
>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.