gre.timer_set_interval
gre.timer_set_interval(
callback,
interval
)
This function creates a repeating timer which fires every "interval" milliseconds and then executes "function"
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | #function | The function to be called when the timer fires interval The time in milliseconds of how often the timer should fire |
Returns
| Type | Description |
|---|---|
| #userdata | A piece of lightuserdata which serves as an identifier for the timer. |
Example
local idval = {}
function cb_func()
print("CB FUNC HAS BEEN CALLED")
end
--Call cb_func every 2 seconds
function cb_set_interval()
idval = gre.timer_set_interval(cb_func, 2000)
end