lua-users home
lua-l archive

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


On 18 April 2012 01:17, Coda Highland <chighland@gmail.com> wrote:
>> Maybe (I dunno) it would be good to also habe a table.len function,
>> which does a slow but reliable count for all types of tables, but of
>> course the # operator still has a valuable place.
>
> This was exactly what I was thinking, and it's a good idea. Have
> table.len() iterate over the full (internally-allocated) length of the
> array part of the table and... what, return the highest index? return
> the number of non-nil elements? Which would be better?
>
> /s/ Adam
>

That's what table.maxn used to do; it was removed cause no one used it.