[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua "..." args
- From: Steve Dekorte <steve@...>
- Date: Wed, 17 Dec 97 15:54:27 -0800
A minor feature request.
It would be nice if, when I have a method using variable args, I
could pass those args along to another function with the "..." syntax.
Example:
function SomeObject:myMethod(blah, ...)
return anotherObject:anotherMethod(...)
end
Instead of the uglier and more limited way:
function SomeObject:myMethod(blah, ...)
local argCount = tableLength(arg)
if ( argCount == 0 ) then
return anotherObject:anotherMethod(forwardMethod)
end
if ( argCount == 1 ) then
return anotherObject:anotherMethod(forwardMethod, arg[1])
end
if ( argCount == 2 ) then
return anotherObject:anotherMethod(forwardMethod, arg[1], arg[2])
end
if ( argCount == 3 ) then
return anotherObject:anotherMethod(forwardMethod, arg[1], arg[2], arg[3])
end
end