timer.performWithDelay returns nil

Hi all!

I want to control my timer so I can pause() and resume() it, but I can’t

local handTimer = timer.performWithDelay( 20, frameUpdate, 0 ) print(handTimer.pause())

and I get an error:

Runtime error

… myfile.lua:681: attempt to call field ‘pause’ (a nil value)

The thing is the timer works, “frameUpdate” function is called every 20 miliseconds, but I cant acces the timer handle. There is no other “handTimer” variables in the code and I tried to call timer.performWithDelay outside any function, inside scene:create, scene:show, but always returns a nil value.

What am I missing here?

branyman,

Try this to pause a timer: 

[lua]

timer.pause(handTimer)

[/lua]

I already solved myself, it was a dumb one :P. The moderator took its time to publish my post :wink: Thank you anyway!

branyman,

Try this to pause a timer: 

[lua]

timer.pause(handTimer)

[/lua]

I already solved myself, it was a dumb one :P. The moderator took its time to publish my post :wink: Thank you anyway!