[Resolved] Timer Troubles

Hello… I’m having a very frustrating time with timer.cancel(). I can’t seem to make the timer cancel without it giving an error. I’ve messed with it and researched it all day, but I haven’t figured it out.
I’ve made the timer with a button…
[lua]local fadeTimer = timer.performWithDelay( 3000, toFadeScreen, 1 )[/lua]
and “canceled” it with a button…
[lua]cancelTimer = timer:cancel(fadeTimer)[/lua]
It gives me this error…

Runtime error
?:0: attempt to perform arithmetic on field ‘_time’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘cancel’
…/nathanballi/Documents//settingsmenu.lua:86: in function ‘onEvent’
?: in function <?:90>
?: in function <?:215>

Do you know the magic words or have any tips from experience? Let me know if you need any more info.

Nathan [import]uid: 39302 topic_id: 25898 reply_id: 325898[/import]

Would have to see more code. Is fadeTimer started within a function or added after the cancel function in the code? [import]uid: 52491 topic_id: 25898 reply_id: 104839[/import]

Well, I got a brilliant idea earlier, and I got it all figured out! I checked out your tutorial… haha Thanks! [import]uid: 39302 topic_id: 25898 reply_id: 104841[/import]

Oh great stuff; well done :slight_smile: [import]uid: 52491 topic_id: 25898 reply_id: 104880[/import]

So? What was the brilliant idea? I get the same error and this thread is anything but helpful now.

From the code supplied above…

He was using timer:cancel() instead of the correct: timer.cancel()

So? What was the brilliant idea? I get the same error and this thread is anything but helpful now.

From the code supplied above…

He was using timer:cancel() instead of the correct: timer.cancel()