gre.timer_set_timeout
gre.timer_set_timeout(
callback,
timeout
)
This function creates a one-shot timer which fires after "timeout" milliseconds and then executes callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | #function | The function to be called when the timer fires timeout The time in milliseconds before 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 after 1 second
function cb_set_timeout()
idval = gre.timer_set_timeout(cb_func, 1000)
end