lua-users home
lua-l archive

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


On Wed, 14 Mar 2007 15:58:08 +0200, Alex Queiroz <asandroq@gmail.com> wrote:

Hallo,

On 3/14/07, Rici Lake <lua@ricilake.net> wrote:

Thirteen values isn't going to blow up the stack :) It would be safe to
use a thousand values, in fact.

     Hmm, if I remember correctly the stack blew on me with much less
than a thousand elements, in a function that sliced a terrain in
several tiles. But anyway, 13 seems safe, I was not following the
discussion thoroughly. :-)


Perhaps you forgot to grow the stack?
From PiL:

When you interact with Lua API, you are responsible for controlling stack overflow. The function
       int lua_checkstack (lua_State *L, int extra);
grows the stack size to top + extra elements; it returns false if it cannot grow the stack to that size. This function never shrinks the stack; if the stack is already larger than the new size, it is left unchanged.

If I rememember correctly, the initial stack size is 20 but this is controled by a #define in Lua sources.
Todor