lua-users home
lua-l archive

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


> A point that does rate some extra explanation, but perhaps iin PiL
> rather than the reference manual, is that 'select' is in fact an
> extremely efficient operation, involving no actual copying of
> arguments. There is no API equivalent, because none is needed.
> It returns the stack exactly as it found it, but reporting a possibly
> different number of return values.

That is not true. 'select' can be quite slow for a large number of
parameters (where "large" starts in the order of a few dozen). In
particular, a typical loop in a vararg function using 'select' is
quadratic with the number of arguments, while creating a table and
traversing it is linear.

-- Roberto