Hi All,
For my idea I need to call my function 10…100 times per second to make some calculation.
To do this I’m tried to use imp.wakeup and I got stack overflow error: ERROR: stack overflow, cannot resize stack while in a metamethod
Here the code:
`function timer() {
imp.wakeup(0.1, timer());
}
timer();`
Do we have any limitation of imp.wakeup usage?
Could someone point me to what I’m doing wrong?
Do we have any other ways to call function periodically?
The function called at wake-up time can’t have parameters, no. But that function can call other functions, which do: function timer(cycles) { cycles--; if (cycles) imp.wakeup(1, function() { timer(cycles) } ); server.log("timer "+cycles); } timer(10);