[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Modifying an array during ipairs traversal
- From: "Aaron Brown" <arundelo@...>
- Date: Sat, 15 Jul 2006 01:42:17 -0400
The section of the manual on ipairs says:
See next for the caveats of modifying the table during its
traversal.
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.)
--
Aaron