lua-users home
lua-l archive

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


On 1 August 2014 11:28, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
table.insert already has an optional middle argument, I don't see any
issue there (yeah some people complain about it, but some people
complain about virtually anything).
table.insert's middle argument is a major wart.
I've seen so many people (new users and experienced) make the mistake of:

    table.insert(t, str:gsub("x","y"))

Which can be much more subtle when people have done the (common) alias of:

    local append = table.insert

(and this is all because `t[#t+1] = v` is labourious to write if `t` is a complex _expression_)
 
And as for the naming, every
single function in the table module already deals only with integer
indices, so I don't see the point in renaming copy to icopy. If you
want to rename something, maybe we should rename the table module to
array.
I think that's come up a few times as a good idea ;)
But I'm not all that bothered by copy vs icopy
I can just see someone asking "why isn't it copying my non-numeric indices?"