[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tables as array and "#" operator for size/length
- From: Tim Hill <drtimhill@...>
- Date: Sat, 14 Sep 2013 23:01:10 -0700
On Sep 14, 2013, at 7:54 PM, Josh Simmons <simmons.44@gmail.com> wrote:
> On 15 September 2013 12:15, IntelliAdmin Support
> <support@intelliadmin.com> wrote:
>>
>> It only counts to the first nil, and stops.
>>
>
> This isn't entirely correct, in a table with holes the # operator can
> return _any_ n where t[n] ~= nil and t[n+1] == nil. It is not
> guaranteed to be the first hole.
>
> You can maintain a count yourself, or avoid putting holes in your tables.
>
> Cheers,
> Josh.
>
No way am I going to contribute to this thread :)
--Tim