lua-users home
lua-l archive

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


>> My opinion is that all proposed operators to get the length of a table
>> are
>> too cryptic to be used with a language with an intuitive syntax as
>> Lua. A
>> more intuitive length operator, at least for me, is |t|. Of course |s|
>> could also be used to get the length of a string.
>
>Why do we need a length operator? And anyway, how do you determine the
>length of a table? It's implementation specific. Do you count the number
>of key-value pairs, the highest numeric key, the number of numeric keys
>etc.?
>
>Look at the getn docs etc.
>
>Nick

I don't really need a length or size operator, I just think it'll be a good thing. Roberto is proposing this new operator (http://bazar2.conectiva.com.br/mailman/private/lua/2004-November/008030.html), I just wanted to say to keep the language easy and intuitive.

Answering your question, for me the length of a table is one that I could use to append values to a table without worrying about overriding something that already was in the table, or, to be more specific, the highest numeric key.