lua-users home
lua-l archive

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


David Jones <drj@pobox.com> writes:

> On 30 Aug 2007, at 12:47, David Kastrup wrote:
>
>>
>> On a different tack: maybe one could optimize usage like
>>
>>    for i=1,#{...} do something(({...})[i])
>>
>> to not actually create tables in order not to have to use select at
>> all?  That would make for more consistency in a different area.
>> Incidentally, {...}[i] is not allowed.
>
> A slight aside: you do realise that #{...} and select('#', ...) don't
> have quite the same meaning?

The select function's description and use in "Programming in Lua" is
not really elaborate enough to get the fine points.  The "Reference
Manual" at least makes it obvious that select returns multiple values
when given a numeric first argument.

The connection with the arg array (in particular with arg[0],
arg[-1]...) outside of any function also is not really documented
exhaustively in either tome.

So I certainly have to plead guilty to most "you do realise" kinds of
question.

-- 
David Kastrup