[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: kick starting lua_next()
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 27 Sep 2004 21:26:33 -0300
> 1) Does lua_next() have to be always kick started by using lua_pushnil() or
> is it acceptable to push any key and the traversal will commence from that
The reference manual, which is the authority on all language matters,
says nothing about this. It only says that pushing nil will signal the
start of a full traversal.
In the current implementation, the traversal will commence from that key.
But that may change in the future, so don't count on it if the manual doesn't
> 2) If the answer to the above is true (pushing a key other than nil is
> acceptable), will lua_next() work if the key is not present in the table
> being traversed?
No, Lua will complain if the key is not present.