Re: tables as array and "#" operator for size/length
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: tables as array and "#" operator for size/length
- From: Josh Simmons <simmons.44@...>
- Date: 2013年9月15日 12:54:52 +1000
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.