I asked this before, but a little vague and poorly worded.
I have a object that takes in Action
s and puts them into a stack that it goes through over time. It performs the first Action
in the stack until it's done, then it performs the second, and so on. There is a RepeatAction
that can take in an array of other Action
s and perform them a number of times in a similar fashion. (.repeat()
simply puts a new RepeatAction
into the objects stack.
Take this for example:
object.repeat(10,[new LogAction(Math.random())]);
Given that LogAction
only takes in a parameter and logs it out. When the object's repeat function gets called it will put 10 LogAction
s into its stack, but they will all log the same number. What I'm looking for is a way that it will log a different number all 10 times.
You may say just pass in Math.random as a function, but then what if I want to pass in 4 * Math.random()
?
Any help?