Server callback
Importing callbacks
local Callback = exports.plouffe_lib:Get("Callback")
Server
Callback.Register(name,cb)
- Params
---@param name string the callback name
---@param cb function the callback function
---@return any void- Example
Callback.Register("hello:world", function(playerId, cb, data)
print(data)
cb("bar")
end)
- Example
Client
Sync
Callback.Sync(name,...)
Params
---@param name string callback name
---@param ... any agrs to be sent
---@return any callback response- Example
local data = Callback.Sync("hello:world", "foo")
print(data)
- Example
Await
Callback.Await(name,cb,...)
- Params
---@param name string callback name
---@param cb function the callback function to be called when its done
---@param ... any agrs to be sent
---@return any void- Example
Callback.Await("hello:world", function(data)
print(data)
end, "foo")
- Example
- Params