lua-users home
lua-l archive

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


Yeah, you're totally right, I apologize for having insisted on my
fault. I didn't understand first explanation :-S

2007/1/20, Chris <coderight@gmail.com>:
The specific problem is with the parsetable(L, -1) recursion:

       if (lua_istable(L, -1)
       {
           parsetable(L, -1);
       }

When that goes into parsetable lua_next is going to use -1 as the
table index.  -1 would be the nil just pushed.  I believe using -2
would work though.

CR


On 1/20/07, Jérôme VUARAND <jerome.vuarand@gmail.com> wrote:
> 2007/1/19, Chris <coderight@gmail.com>:
> > That won't work either because the index is relative and there will be
> > more stuff on the stack.
>
> The code I posted originally only contains balanced functions, so the
> -1 index is always correct when the recursive function hits lua_next,
> except if dosomestuff push stuff on the stack.
>