Client callback
Importing callbacks
local Callback = exports.plouffe_lib:Get("Callback")
Server
Callback.Await(playerId,name,timeout,cb,...)
- Params
---@param playerId number player id to callback
---@param name string the callback name
---@param timeout number the maximum time for the callback to be accomplished
---@param cb function the function callback
---@param ... any the params to be sent to the callback
---@return any void- Example
Callback.Await(playerId, "hello:world", 30, (data)
print(data)
end, "foo")
- Example
Client
Callback.Register(name,cb)
- Params
---@param playerId number player id to callback
---@param name string the callback name
---@param timeout number the maximum time for the callback to be accomplished
---@param cb function the function callback
---@param ... any the params to be sent to the callback
---@return any void- Example
Callback.Register("hello:world", function(cb,data)
print(data)
cb("bar")
end)
- Example