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
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
Use unpack()
:
function test(a,b,c)
print(a+b+c)
end
myargs = {1,2,3}
test(unpack(myargs)) -- prints "6"