lua-users home
lua-l archive

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


On Aug 29, 2014, at 9:03 PM, Andrew Starks <andrew.starks@trms.com> wrote:

> I'm curious about why it is not possible to do something like:
> 
> `function o.method(self, fun, ...)
> 
> success, ... = pcall(fun, ...)
> --vararg now return values of fun
> -etc.
> 
> end
> `
> 
> I assume this has been a topic, because its use would be pretty obvious. I couldn't come up with anything via the googles, so could someone point the way to where this was discussed?
> 
> 
> -Andrew

You can of course use table.pack() to capture vararg return values, which allows you to do what you want indirectly, though it doesn’t answer your question of why you cannot assign to “…” (though I’m not sure that’s such a good idea anyway).

—Tim