lua-users home
lua-l archive

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

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

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
|    | only if it is a letter or digit (20.5.16) but is
| ( | not a digit (20.5.14)." --- SMSDN Java
+- --+ documentation

Attachment: pgpiv_RZ01aYI.pgp
Description: PGP signature