lua-users home
lua-l archive

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

On Fri, Feb 8, 2013 at 3:37 PM, Ivo Beltchev <> wrote:
> I’d like to know in what cases I can count on deterministic order of table
> iteration. I’m pretty sure if the keys are objects that are stored in memory
> (like tables, threads, closures, or full user data), the order is not
> deterministic. But what if the keys are limited to simple types, like
> numbers, strings, booleans, light user data? Is the order going to be always
> the same?

no.  if you want deterministic order, you can easily keep a copy of
the keys on the array part, like table.sort() result.