lua-users home
lua-l archive

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

On Thu, Jan 27, 2011 at 8:42 AM, David Manura <> wrote:
> The Reference Manual specifies the mechanics of `__ipairs` [1] but not
> its intended purpose.

Interesting points!  If I see ipairs(), I expect an array-like
iteration with integer indices in ascending order, although not
_necessarily_ a contiguous sequence in the case of a sparse array.
Otherwise, since we have __len and __index, there would be no point in
__ipairs since the numeric for is clearer in most cases (although not
more efficient in the case of a proxy table)

__ipairs means that ipairs can be trained to go over
arrays-with-holes, which can be useful.

The general virtualization problem for tables remains vexing.

steve d.