# Package timer
# Functions
# interval
Execute function every x seconds indefinitely. If the function executed returns
false
the timer is removed.
# Example
function doAgain()
print("Executing...")
end
local t = timer:interval(5, doAgain)
# after
Execute specified function after x seconds.
# Parameters
Name | Optional | Description |
---|---|---|
Time | No | Time in seconds |
Function | No | Function to execute after time |
# Example
function doLater()
print("Doing after 10 seconds")
end
local t = timer:after(10, doLater)
# timer object
The timer functions return an object for that specific timer. It can be used to cancel the timer.
# Example
The timer will be stopped immediately without execution.
function doLater()
print("Doing after 10 seconds")
end
local t = timer:after(10, doLater)
t:cancel()