Posted 24 April 2013 - 03:09 AM
Yea, question is in the title ^_^/>
thx for reading
-Freack100-
thx for reading
-Freack100-
function someName( ... )
local params = { ... }
for _,v in ipairs(params) do
print(v)
end
end
someName( 'hello' )
someName( 'hello', ' ', 'world', '!' )
local params = ...
you would only get the first one, hence putting it in a table
local p, a = ...
and it will get the first 2
function someName( something, ... )
and the first value passed in will go into something the rest goes into the …
function someName( ..., something )
Thanks a lot!Like so:function someName( ... ) local params = { ... } for _,v in ipairs(params) do print(v) end end someName( 'hello' ) someName( 'hello', ' ', 'world', '!' )
EDIT: more examples
if you didn't do thisyou would only get the first one, hence putting it in a tablelocal params = ...
you can even do thisand it will get the first 2local p, a = ...
lastly you can also do thisand the first value passed in will go into something the rest goes into the …function someName( something, ... )
however you cannot do thisfunction someName( ..., something )