Skip to main content
Version: 9.0.2

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

ParameterTypeDescription
callback#functionThe function to be called when the timer fires timeout The time in milliseconds before the timer should fire [

Returns

TypeDescription
#userdataA 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