lua-users home
lua-l archive

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

The section of the manual on ipairs says:

See next for the caveats of modifying the table during its

The section on next says:

The behavior of next is undefined if, during the
traversal, you assign any value to a non-existent field in
the table. You may however modify existing fields. In
particular, you may clear existing fields.

This warning is only worded to apply to next, which ipairs
doesn't use.  Is it really intended to apply to ipairs too?

(In the current implementation, assigning to a nonexistent
field has exactly the result that one would predict from the
manual's description of ipairs, which simply stops whenever
it hits a key whose value is nil.)