Re: recursively traverse globals table from C API
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: recursively traverse globals table from C API
- From: Chris <coderight@...>
- Date: 2007年1月20日 08:12:54 -0500
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.