Serp
King
- Joined
- Apr 1, 2015
- Messages
- 666
Hi,
how to enter a mutable number of arguments to a function ?
Like:
the problem is, that the testfunction is fix. So I'm not able to change it to handle an array itself.
The testfunction is able to accept an endless number of arguments.
how to enter a mutable number of arguments to a function ?
Like:
Code:
array = {}
for i = 1 , math.random(1,80) do
array[i] = i -- this array gets a random number of entries.
end
-- Each entry has to be one argument for the testfunction.. but I don't know how
if array[1] and not array[2] then
testfunction(array[1])
elseif array[1] and array[2] then
testfunction(array[1],array[2])
-- ... ... ...
end
the problem is, that the testfunction is fix. So I'm not able to change it to handle an array itself.
The testfunction is able to accept an endless number of arguments.