lua-users home
lua-l archive

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


Sorry. But I have mistyped  ...
unpack{ ... , "a" } just works :p

Thanks for the detailed explaination all the same!

On Tue, Nov 11, 2008 at 7:26 PM, Duncan Cross <duncan.cross@gmail.com> wrote:


On Tue, Nov 11, 2008 at 11:14 AM, Jun Wu <idearet@gmail.com> wrote:
It works.
And I suggest t be a local variable.
Since unpack() do the trick, the code can be shorten to:

function (...)
  return unpack(..., "a")
end

Hope it helps.

No, it can't - that is the point, you cannot just use "..., something" and expect it to add "something" onto the end.

Also, using unpack() directly on "..." will not work. It is expecting a table only.

Finally, the technique of putting "..." into a temporary table and using unpack on it was already mentioned in the original post. Atry's already aware of it and was asking if any better alternative methods exist.