[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C API - lua_next traversal of "array" table
- From: Pedro Tammela <tammela@...>
- Date: Wed, 17 Aug 2016 15:17:23 -0300
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?
I don't think lua_next() suits array interations. In my honest opinion, lua_next() is suitable for really special tables.
I recommend you to see Programming in Lua (Third Edition) Chapter 28, when Roberto explains array manipulation via the C API.
Sorry for not answering your question, I just think there's a better way!