lua-users home
lua-l archive

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


On 08/01/2010 23:08, Alexander Gladysh wrote:

17. Documented behaviour of ipairs() is changed from "iterates until
*first nil*" to "traverses table length elements as defined by length
operator".

1) I welcome this change (even if it is documentation-only), as it
makes documented behaviour more consistent.
2) But, is *actual* behaviour changed? I failed to find such change in a source.

I think it is.

for k,v in ipairs({1,2,nil,3}) do
  print(k,v)
end

With Lua 5.1.4:

Lua 5.1
1	1
2	2

and with Lua 5.2:

1	1
2	2
3	nil
4	3