Would it be possible for a function to be called a lot of times at the same time?
How could I (If it's even possible) make a function run multiple times (lets say 12) with different parameters each time when called ?
How could I (If it's even possible) make a function run multiple times (lets say 12) with different parameters each time when called ?
You can place the items you want to pass to the function in a list.
You can get the number of variables passed to the function via code like this.
f = function(a, b)
print( f.num_args )
end
This code will always show 2 variables - because there are two parameters in the code.
If you call the function without parameters or with 10 parameters, it will also show 2.
print( f.arg1 )
print( f.labels )
print( f.locals_size )
You can also read other fields .
There is also one secret hidden variable called
arguments
.
With its help you can read all parameters passed to the function .
f1 = function()
for a in arguments
print( " >> " + a )
end
print("------------")
end
init = function()
f1()
f1(12)
f1(12,34)
f1(45,67,89)
end
Ah, I get it now, thank you.