
On 16/06/2011 16.41, HyperHacker wrote:
On Jun 16, 2011 12:29 AM, "Lorenzo Donati" <lorenzodonatibz@interfree.it
> "A table is called a sequence if there exists a nonnegative integer n such that the set of its numeric keys is {1...n}. In this case n is defined as the length of the sequence. An empty table {} or a table with no numeric keys is considered a sequence of length 0." > > > Does that mean a table having keys 0, 1 or 1.5 no longer has a defined length?
That's what I understood reading 5.2 manual. Any numeric key which is either noninteger or outside the 1...n integer range disrupts the "sequenciness" (ugly, but clear :) of the table.
I suppose that was also the behaviour in 5.1, but I didn't test it. I always considered bad practice to put negative or noninteger numeric keys in a table and still considering it an "array" (old terminology).
As for "arrays" with an added 0key element I'm not sure. I don't remember having had problems treating, for example, lua standalone interpreter's "arg" as an array, which has arg[0] (and even may have arg[1], arg[2], ...).