lua-users home
lua-l archive

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


I'm aware that, when using 'next', "The order in which the indices are enumerated is not specified".

But my question is:
- Is that order always the same, given the following conditions?

t = {
  a = { x=1, y=2 },
  b = { x=3, y=4 }
}

for k,v in next, t do
  -- don't change k (of course)
  -- don't change v
  -- may change v.x, v.y
  -- may add new fields to v
end

Given those assumptions, is the order of traversal of t always the same in different invocations of this loop (either b,a or a,b in this case) or is this not guaranteed?

  Enrico