Timer
timer:create
Shared
Creates a new timer context
Syntax
local ctx = timer:create(exec, interval, executions, ...)Parameters
| Type | Name | Description |
|---|---|---|
function | exec | Function to be executed by the timer |
int | interval | Execution interval in milliseconds |
int | executions | Total number of times the function will execute |
... | ... | Additional arguments to pass to the exec callback |
Returns
| Type | Name | Description |
|---|---|---|
timer / bool | ctx | Returns timer instance on successful execution, or false on failure |
Callback
exec(...)| Type | Name | Description |
|---|---|---|
... | ... | Additional arguments |
Examples
local self = timer:create(function(message)
engine.print(message)
end, 1000, 5, "Hello from timer")