lua-users home
lua-l archive

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


I tried something like

function x(...)
  return function()
    for i=1, select('#', ...) do
      print(select(i,...))
    end
  end
end

(x(3,4,5))()

And it complains with

> function x(...)
>>   return function()
>>     for i=1, select('#', ...) do
stdin:3: cannot use '...' outside a vararg function near '...'
>       print(select(i,...))
stdin:1: bad argument #1 to 'select' (number expected, got nil)
stack traceback:
        [C]: in function 'select'
        stdin:1: in main chunk
        [C]: ?

Is there a rationale for this behavior, or does it just happen to be
this way?

Thanks,

-- 
David Kastrup