lua-users home
lua-l archive

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


>> And there are no plans to change varargs in 5.2.

Thanks to heaven. I don't see where '...' construct is not well suited inside the language right now
unlike 'vararg' in Lua 5.0.

>> -- Roberto

> I'm sure I've heard it repeatedly stated that vararg would change in
> 5.2 in this very list. Also:
>> function f(x,...) print(#...) end
>> f(1,2,3,4)
> stdin:1: attempt to get length of a number value
> It doesn't work, because "#..." expands to "#2,3,4" which doesn't make sense.

Not quite correct. '#' expects exactly one parameter, so '...' is adjusted to one result
which is a number (that's a separate part of the story).