Hi,
I would like some help in understanding why the code below causes a stack overflow error. While I can see there is an infinite loop going on, I don’t understand why it should happen when timer.performWithDelay() normally just happens happily in the background. ie. the rest of the program doesn’t have to wait for the specified delay to occur before it’s business as usual.
function foo() if n == 0 then n=1 timer.performWithDelay(1000,foo()) else n=0 timer.performWithDelay(1000,foo()) end end timer.performWithDelay(1000,foo())