[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C API - lua_next traversal of "array" table
- From: Philipp Janda <siffiejoe@...>
- Date: Wed, 17 Aug 2016 22:41:25 +0200
Am 17.08.2016 um 22:30 schröbte Dirk Laurie:
2016-08-17 19:41 GMT+02:00 ThePhD <email@example.com>:
I have a small question regarding the Lua C API's "lua_next" function when
used on a certain subset of objects: tables that are made like arrays, with
sequential integer keys. Is the order of iteration guaranteed to go from '0'
to 'N' in this case, or am I still subject to jumping around in some
implementation-defined order of traversal?
Nothing is guaranteed, except that if you start from the initial value k=nil
then repeat k,v = next(tbl,k) until not k will visit every key.
`false` is a valid key.