lua-users home
lua-l archive

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


On Wed, Jan 27, 2016 at 10:34 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2016-01-27 19:11 GMT+02:00 Stephan Hennig <sh-list@posteo.net>:
>
>> The fact that iterating over table elements via ipairs and iterating over
>> table indices 1 to #t are not equal operations has been discussed on
>> this list before.  But it is neither mentioned in the section describing
>> ipairs nor in the section describing the # operator.  I think this fact
>> deserves more visibility in the manual.
>
> The manual is very cute at saying enough, but only barely.
>
> In this case it says
>
>     will iterate over the key–value pairs (1,t[1]), (2,t[2]), ..., up to the
>     first nil value.
>
> The notation t[1] implies that __index is respected, the failure to
> mention #t means that __len is ignored. Terse, but it has always
> been like that.
>
> You say this is actually documented in "Changes to the libraries"?
> That's being absolutely verbose, then!
>

The context suggests that he's concerned that future manuals -- when
that's no longer considered a change, and therefore won't be in that
section -- will lose that visibility.

/s/ Adam