lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Sep 29, 2016 at 7:40 PM, Russell Haley <russ.haley@gmail.com> wrote:
 re-discovered last night: iterating through a table does not guarantee
> the items are in the same order they are created?

ipairs() gives you that guarantee, pairs() definitely does not.  It's
a hash map so things can get semi-random.

If order is important, keep another array (with table.insert) of the
keys and use them to iterate through the 'map' of names to values.