lua-users home
lua-l archive

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

> However in my 2-nd example (where table.concat throws an error),
> it's obviously using table.getn internally, but the docs seem to
> not mention that.

>From the docs:

(Introduction to the table library.)

> Most functions in the table library assume that the table represents
> an array or a list. For those functions, an important concept is the
> size of the array. There are three ways to specify that size:
>   * the field "n" --- When the table has a field "n" with a numerical
>   value, that value is assumed as its size.
>   * setn --- You can call the table.setn function to explicitly set
>   the size of a table.
>   * implicit size --- Otherwise, the size of the object is one less
>   the first integer index with a nil value.
> For more details, see the descriptions of the table.getn and
> table.setn functions.

> table.concat (table [, sep [, i [, j]]])
> Returns table[i]..sep..table[i+1] ... sep..table[j]. [...]
> and the default for j is the size of the table. [...]

-- Roberto