lua-users home
lua-l archive

table & multiple arguments

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


>From the manual, I see a function can take indefinite number of
arguments by taking them from a table. But how about the reverse?
function foo(a, b, c)
 print(a, b, c)
end
Doing foo(1, 2, 3) works perfectly, but 
x = { 1, 2, 3 }
foo(x)
is an obvious error. How do I pass a flattened table as function
arguments? Is there any specific syntactical sugar for this? 
I know in Pike, you can do foo(@x), and foo(1, @y), etc.
Thanks in advance!
Regards,
.paul.

AltStyle によって変換されたページ (->オリジナル) /