[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: new thought experiment: what would you add to Lua ?
- From: Sean Conner <sean@...>
- Date: Fri, 14 Sep 2018 20:02:46 -0400
It was thus said that the Great Andrew Gierth once stated:
> Something like #... to return the number of varargs without needing to
> pass them all to another function as in select('#',...).
+1. And ...[i] to reference them. Example:
function foo(...)
for i = 1 , #... do
print(i,...[i])
end
end
or even
function foo(...)
for i,v in ipairs(...) do
print(i,v)
end
end
Although I think that last one might be difficult to pull off.
-spc