M MY Multiplayer: Wiki
Side
Kind

call

Shared

Calls a function another resource exports in its meta.xml and returns what it returns.

any call(resource|string resource, string functionName, any ...)

Parameters

NameTypeDescription
resourceresource|stringThe resource, or its name.
functionNamestringThe exported function's name.
...anyArguments passed to the function.

Returns

The values the function returned, or false if the resource is not running, does not export the function on this side or the call failed.

During the call, the called resource's sourceResource global is the calling resource.

Example

local balance = call("bank", "getBalance", "c3f1a2")
if balance then
    outputServerLog("balance: " .. tostring(balance))
end

See also