[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Catching and passing multiple values
- From: David Given <dg@...>
- Date: Wed, 22 Feb 2006 11:02:38 +0000
On Wednesday 22 February 2006 05:01, Gavin Kistner wrote:
[...]
> Is there a clean way to do the above (catch, save, and then later
> return) in Lua? (I had hoped I could use a vararg expression
> magically in place of "*matches" above, but obviously that doesn't work.
You can do this:
function catchparms(a, b, ...)
return a, b, arg -- replace arg with {...} in Lua 5.1
end
local theStart, theEnd, parmList = catchparms(string.find(...))
...although I agree, it's ugly, and some syntactic sugar for doing this kind
of thing would be really nice.
--
+- David Given --McQ-+ "A character is considered to be a letter if and
| dg@cowlark.com | only if it is a letter or digit (20.5.16) but is
| (dg@tao-group.com) | not a digit (20.5.14)." --- SMSDN Java
+- www.cowlark.com --+ documentation
Attachment:
pgpmfgsnrfBBZ.pgp
Description: PGP signature