lua-users home
lua-l archive

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


this indeed a very deep hole :-) I have jumped into it before, and I
think there will be more and more people jump into this deep hole :-)

so, maybe a example in documentation is better.

regards,
Xavier Wang.

2012/7/4 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> 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
>