[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: about the next version
- From: Edgar Toernig <froese@...>
- Date: Wed, 19 Dec 2001 00:10:48 +0100
RLake@oxfam.org.uk wrote:
> >>
> >> function printf(file, fmt, ...) write(file, format(fmt, argfn())) end
> >> -- The argument fmt is only provided for documentation purposes --
>
> > You can already do this with the 'unpack' function. For instance:
>
> > function printf(fmt, ...)
> > write(format(fmt, unpack(arg)))
> > end
>
> Yeah, I know... I just thought it would be more cool (and faster) to not
> have to make a table and then unpack it.
Wouldn't this be easier?
function printf(file, fmt, ...) write(file, format(fmt, ...)) end
That is, allow the dots as arguments that expand to the passed varargs.
The creation of the arg-table can be postponed until it is really
needed (or even made by hand: local arg={...}).
Ciao, ET.