[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (work4) now available
- From: Quae Quack <quae@...>
- Date: Mon, 2 Aug 2010 09:18:59 +1000
On 2 August 2010 03:28, Roberto Ierusalimschy <email@example.com> wrote:
>> >ipairs in work4 behaves identically to the 5.1 version. (with the
>> >exception of returning nil in place of nothing)
>> >Is the doc wrong or the code?
>> I believe the doc is wrong, since the thinking was that since ipairs
>> is being deprecated there was no reason to also change its
> The doc is wrong, but not because of this thinking (given that it is not
> being deprecated any more). The problem is that, with the possibility
> of tables to redefine '#', the implementation was wrong, and a correct
> implementation was somewhat expensive (checking against '#' in every
> Anyway, ipairs is back with its 5.1 semtantics.
> -- Roberto
I think the new semantics are appropriate; though I think you should
use the raw length...
for tables that redefine __len; they should also be defining __ipairs