[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ... efficiency (was Re: class implementation)
- From: Adrian Sietsma <adrian_groups@...>
- Date: Thu, 06 Apr 2006 11:36:04 +1000
Diego Nehab wrote:
...
While we are at it, anyone thought about having ... as an "l-value"?
function capture(s, pat)
local i, j, ... = string.find(s, pat)
return ...
end
I would love this. Too many times I have to choose between
local ret,err,a,b,c,d = fn()
if not ret then f2(a,b,c,d) end
and
local t = {fn()}
if not t[1] then f2(unpack(t,3,table.maxn(t))) end
neither is pretty.
But how do we distinguish between the "vararg" "..." and the l-value "..." ?
Only ever allow one list, I think, so l-value overwrites previous "..."
Adrian