Timer.Start issue

Hi
I am completely new to EPS8266 and Lua (but not to programming - my first CPU was an 8080...)
Using a nodemcu HUZZA from adafruit
Anyway I am testing some timer stuff and running into this:
Without the stop, it keeps printing... so far so good.
But if I want to start the timer again like:
I get an error: "PANIC: unprotected error in call to Lua API..."
The documentation says that the tmr is still registered when stop is called.
A call to tmr.state(0) does the same. Only tmr.stop(0) seems to works as expected.
Thanks for your thoughts.
I am completely new to EPS8266 and Lua (but not to programming - my first CPU was an 8080...)
Using a nodemcu HUZZA from adafruit
Anyway I am testing some timer stuff and running into this:
Code: Select all
tmr.alarm(0, 500, 1, function()
print("I'm here")
tmr.stop(0)
end)
Without the stop, it keeps printing... so far so good.
But if I want to start the timer again like:
Code: Select all
tmr.alarm(0, 500, 1, function()
print("I'm here")
tmr.stop(0)
-- do stuff
tmr.start(0)
end)
I get an error: "PANIC: unprotected error in call to Lua API..."
The documentation says that the tmr is still registered when stop is called.
A call to tmr.state(0) does the same. Only tmr.stop(0) seems to works as expected.
Thanks for your thoughts.