exportFunction

From GTA Connected
Revision as of 02:31, 10 April 2026 by PerikiyoXD (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Server and Client GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0
void exportFunction(string name, function Function)
The exportFunction function is used to export a function so it can be used in other resources.

Parameters

1) string name The name of the exported function.
2) function Function The function to export.

Return

void This function doesn't return a value.

Notes

  • To use this function in another resource, use findResourceByName in the other resource, which returns a resource object. You can then use resource.exports or resource.getExport to access exported functions.
  • Only simple types (string, number, boolean, null) are guaranteed to work across resource boundaries. Passing compound types (objects, arrays, tables) is discouraged — depending on the language combination involved, this may cause crashes or undefined behaviour. If structured data must be passed, serialize it to a JSON string before the call and deserialize on the receiving side.

Examples

Example 1 - JavaScript:

bindEventHandler("OnResourceStart", thisResource, function(event, resource) {
    exportFunction("testFunc", testFunc);
});
function testFunc(foo, bar) {
    return true;
}

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png exportFunction

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.call
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.clone
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.createFunction
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.move
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.tostring


Client Related

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png exportFunction

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.call
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.clone
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.createFunction
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.move
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png reflection.tostring