Timeout

MSK.Timeout.Set

Set a new asyncron timeout

Parameters miliseconds - number - Time to wait cb - function - Callback Function

timeout = MSK.Timeout.Set(miliseconds, function(data)
    print(data) -- Output: 'Hello World'
end, 'Hello World')

-- You can also use:
timeout = MSK.Timeout(miliseconds, function(data)
    print(data) -- Output: 'Hello World'
end, 'Hello World')

-- As an Export:
local timeout = exports.msk_core:SetTimeout(miliseconds, cb)

MSK.Timeout.Clear

Clears the given timeout

Parameters timeout - number - Timeout ID

MSK.Timeout.Await

Calls a function repeatedly until it receives a non-nil value, or it times out. The function result is then returned.

Thanks to ox_lib for this amazing function!

Parameters miliseconds - number - Time to wait cb - function - Callback Function errorMessage - string - Message on error

Returns value - ? - The given value

Last updated