lua-users home
lua-l archive

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


> I'm confused by what you mean here. table.concat(), like all the other
> table functions like table.sort() and table.insert(), expects to take
> a valid Lua array-table and if you pass it one with nils/holes in, it
> usually raises no error and just has undefined results. We are
> expected to know and understand this for the other functions, why not
> table.concat() too?

Sorry, the nil example is not a good one ;) Any other type will do. For
instance, if you add a function to a table and then call 'table.concat',
do you really want to have 'function: 0x9fb7020' in the resulting
string?  Or, more probably, you wanted to add the function result but
got it wrong?

If you want to 'tostring' the elements, you can do it while adding
them to the table, no need to retraverse the table later.

-- Roberto