class Exports
package fivem.shared.core
Resource exports — the supported way for resources written in different languages to call into each other.
// In your resource:
Exports.register("getBalance", (playerId:Int) -> accounts.balanceOf(playerId));
// From any other resource, Lua or Haxe:
var balance:Int = Exports.call("my-bank", "getBalance", 3);
exports is a callable table injected by the FiveM runtime rather than a
native, so both directions go through the small Lua glue below — the same
approach fivem.server.db.OxMysqlBridge uses.
Exports are synchronous across the resource boundary but not across the
network: client code can only call client exports, server code only server
exports. Use Callbacks to cross that gap.
Static methods
staticcall(resourceName:String, name:String, args:Rest<Dynamic>):Dynamic
Calls name on resourceName and returns its result.
Throws a Lua error (catchable with try/catch) if the resource isn't
started or doesn't export that name — guard with
Resource.isStarted(...) when the dependency is optional, or use
tryCall.
staticregister(name:String, handler:Function):Void
Publishes handler under name, callable by any other resource in the
same environment.
Anything crossing the boundary is msgpack-serialised, so pass plain data — numbers, strings, arrays, anonymous structures. Class instances arrive on the other side as bare tables with no methods.
statictryCall(resourceName:String, name:String, args:Rest<Dynamic>):Null<Dynamic>
Like call, but returns null instead of throwing when the resource
isn't started or the call fails. Intended for soft dependencies.