Skip to content
GAMPEONCreate
New project
Preview: this works today, but details can still change.

Exports

Functions one resource offers to other resources on the same side.

exports(name, fn)

Offer a function to other resources, or call one. Server and client.

Call exports('name', fn) to offer a function. Other resources call it with exports.yourresource:name(...) or exports['your-resource']:name(...). Arguments and return values are copied. Functions in them, also inside tables, stay callable and run in the resource they come from, so an export can return an object with methods. Such a function stops working when its resource stops or restarts. Exports only work between resources on the same side.

Parameter Type Description
name string Name of the export.
fn function The function to offer.
-- in resource 'bank'
exports('GetBalance', function(playerId)
return balances[playerId] or 0
end)
-- in another resource
local money = exports.bank:GetBalance(source)

Compared to FiveM: Same as in FiveM, including function references. If the export calls Wait, a caller in a thread or event handler waits for the result; elsewhere the result is lost and the log says so.

Report a problem with this pageOther ways to give feedback