[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: select("#", ...) idiom
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 14 Sep 2005 17:09:39 -0300
> Perhaps I missed this? What is its meaning?
... is an expression. #exp returns the length of the result of exp.
So, #... is the length of the first argument of a vararg function.
function f (...) return #... end
print(f("hi", 4, 5))
Similarly, <<for i, v in ...>> also has a meaning. See next example:
function f (...) for i,v in ... do print(i,v) end end