lua-users home
lua-l archive

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


On Tue, 2011-03-01 at 15:21 -0500, Patrick Donnelly wrote:
> I really hope programs like this do not become common. Making a new
> garbage table on every insert?! This is why I advocated having
> table.pack accept a table argument...

I personally wouldn't like to have to write 'table.pack({}, ...)' every
time I wanted to pack the arguments into a new table.

On the other hand, having the table argument optional (either first, or
last) is not an option, because what would happen here?

function f(...)
  local t = table.pack(...)
end

f({})

Is the first argument a table that I want to fill, or an argument?