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月19日 22:01:08 -0500
On 1/19/07, Rici Lake <lua@ricilake.net> wrote:
By the way, be careful with recursively enumerating tables; if there's
a circular reference, you'll find yourself running off the end of the C
stack. (And, since _G._G == _G, there is such a circular reference in
the standard globals table.)
One thing I found interesting (my original code seems to work by the
way, just don't use lua_tostring on the key) is that it never
enumerates the _G._G circle. It seems to work as expected,
enumerating everything else and then exiting without entering a
infinite loop.
CR