# call (Shared)

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

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/call

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `resource` | `resource\|string` | The resource, or its name. |
| `functionName` | `string` | The exported function's name. |
| `...` | `any` | Arguments 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

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

## See also

- [getResourceExportedFunctions (Shared)](https://wiki.mymp.gg/en/getResourceExportedFunctions.md): Lists the names of the functions a resource exports in its meta.xml, on any side.
- [import (Shared)](https://wiki.mymp.gg/en/import.md): Runs a resource's module in this script's Lua state, once per state, and gives back what it returned. The globals the module set become this script's.
- [getResourceFromName (Shared)](https://wiki.mymp.gg/en/getResourceFromName.md): Finds a resource by name.
