lua-users home
lua-l archive

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


On Mon, 10 Nov 2008 10:17:16 +0100
"Peter Jacobi" <pjacobi.de@googlemail.com> wrote:

> Is there a deep reason that
> 
> function Tuple.new (...)
>    return function () return ... end
> end
> 
> doesn't work and must be simulated using:
> 
> function Tuple.new (...)
>     t = {...}
>     return function () return unpack (t) end
> end
yes. closures doesn't include vararg(...), so you must explicitly
assign vararg to variable. and then variable will be 'closed'.