[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible bug relating to table sizes
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 31 Oct 2011 11:27:25 +0200
2011/10/31 Lorenzo Donati <lorenzodonatibz@interfree.it>:
> The length operator '#' returns the intuitively-correct value only for
> tables which are "arrays" ("sequences", in the new Lua 5.2 parlance), i.e.
> tables whose numeric keys begins at 1 and ends at some other integer N. If
> there are "holes" or non integer numeric keys, '#' returns weird values,
> …
> The same applies to ipairs (it will traverse an array only if *it is* an
> "array") and almost all other table library functions.
>
5.2 beta allows you to supply an __ipairs metamethod. Overriding the
__len metamethod has no effect on the standard ipairs.
Dirk