lua-users home
lua-l archive

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


* Dirk Laurie:

> If A and B are tables with exactly the same set of keys,
> must`next(A,k)` and `next(B,k)` always give the same first return
> value?

No, this isn't even true for Lua 5.1:

local N = 6
local t1 = {}
for i = N/2, N do
   t1[i] = true
end
local t2 = {}
for i = N, N/2, -1 do
   t2[i] = true
end
print(next(t1, nil))
print(next(t2, nil))

(Suitable choices for N may be architecture-dependent.)