apex.ipc.invoke
Calls another instance's handler and waits for its answer.
Syntax
apex.ipc.invoke(target: Peer | number | string, topic: string, ...: any) -> ...any
Parameters
| Parameter | Type | Description |
|---|---|---|
target | Peer, number or string | The instance to call. |
topic | string | A topic the target answers with apex.ipc.handle. |
... | any | Values passed to the handler. |
Returns
| Type | Description |
|---|---|
...any | What the handler returned. |
Description
The calling thread yields until the answer arrives. It raises an error when the target is not in a game, has no handler for the topic, its handler fails, it leaves before answering, or 30 seconds pass. Values follow the rules of apex.ipc.send, both ways.
Example
local ok, items = pcall(apex.ipc.invoke, "FarmAccount2", "inventory", "tools")
if ok then
print("FarmAccount2 has", #items, "tools")
else
warn(items)
end
These are Game executor contracts. Check build requirements and session lifetimes before using them.
