views:

216

answers:

1

Hi,

I have numerous functions (unknown at design time) that each take a specific number of arguments. I have a table of arguments. How do I call those functions with this table of arguments?

Thanks, James

+5  A: 

Use unpack():

function test(a,b,c)
   print(a+b+c)
end

myargs = {1,2,3}

test(unpack(myargs)) -- prints "6"
Amber