[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Documentation for select 5.1 and 5.2
- From: liam mail <liam.list@...>
- Date: Wed, 4 Jul 2012 15:06:21 +0100
On 4 July 2012 13:47, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> Is the documentation for the select function [1] [2] correct when an
>> number is provided for the first parameter as the docs say
>> "returns all arguments after argument number index"
>>
>> Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
>> > do
>> local f = function(...) print(select(1,...)) end
>> f(1,2,3)
>> end
>> 1 2 3
>>
>> Index one is not after index one and index zero gives an invalid range
>> error, I suspect it should say something to the effect of
>> "returns all argument after and inclusive of argument number index"
>
> Refrasing your example:
>
>> print(select(1, 10, 20, 30))
> 10 20 30
>
> '10' is the second argument, not the first.
>
> -- Roberto
>
Yes, now I see that argument refers to the select function's
arguments; whereas before I was thinking it was in relation to the
varargs.
Thanks
Liam