Last active
March 20, 2019 14:28
-
-
Save ElectricImpSampleCode/265750e4fe15b9ca18d926fcb63d4ad7 to your computer and use it in GitHub Desktop.
Code demonstrating the use of names in imp.cancelwakeup() on the agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set up a timer... | |
imp.wakeup(60, | |
function() { server.log("Timer \"wakeup_timer\" woke up"); }, | |
"wakeup_timer"); | |
// ...but cancel it before it fires... | |
local timer = imp.wakeup(40, function() { | |
server.log("Timer \"wakeup_timer\" cancelled"); | |
imp.cancelwakeup("wakeup_timer"); | |
}); | |
// ...or maybe not! | |
imp.cancelwakeup(timer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment