Callbacks
callback.lua
These functions wrap the native callback handling of the selected framework (e.g., OX, QBCore, ESX) instead of implementing a standalone callback system, ensuring full compatibility.
createCallback(callbackName, funct)
Registers a callback function with the appropriate framework.
It adapts the callback function to match the expected signature for the framework.
Example:
local table = { ["info"] = "HI" }
createCallback('myCallback', function(source, ...)
return table
end)
createCallback("callback:checkVehicleOwned", function(source, plate)
local result = isVehicleOwned(plate)
if result then
return true
else
return false
end
end)
triggerCallback(callbackName, ...)
Triggers a server callback and returns the result.
Example:
local result = triggerCallback('myCallback')
jsonPrint(result)
local result = triggerCallback("callback:checkVehicleOwned", plate)
print(result)
Last updated