Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ability to cancel specific timers #4

Closed
viviicat opened this issue Mar 30, 2012 · 2 comments
Closed

Feature request: Ability to cancel specific timers #4

viviicat opened this issue Mar 30, 2012 · 2 comments

Comments

@viviicat
Copy link

It's stupidly easy--I suppose all you need to do is add:

local function cancel(timer)
   functions[timer] = nil;
end

But it would be very useful--sometimes when I'm switching states I want to cancel some of the timers I have set up.

Thanks, and thanks for making Hump, it's a great library :)

@vrld
Copy link
Owner

vrld commented Mar 31, 2012

Good idea! To make this work correctly, Timer.add() and Timer.addPeriodic() now return handles to the timer. Be sure to use these handles when canceling a timer, and not the original function.

@vrld vrld closed this as completed Mar 31, 2012
@viviicat
Copy link
Author

Thanks a lot. I'll give it a shot for my next project.

NickFlexer pushed a commit to NickFlexer/hump that referenced this issue Oct 5, 2020
move pr to temp-master with other changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants