getcommchannel(id) / get_comm_channel(id)
Returns a communication channel by id.
Syntax
getcommchannel(id: number) -> table?
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | Id returned by createcommchannel. |
Returns
| Type | Description |
|---|---|
table? | The original channel table in its creating state, a Fire-only table in other states, or nil. |
Description
Looks up the process-wide channel registry. In the creating state the exact same table is returned; in another actor state a table with Fire is returned so the actor can send messages back.
Firing with an unknown id is a no-op.
Example
local id = createcommchannel()
local channel = getcommchannel(id)
channel:Fire("hello", game, nil)
Notes
- getcommchannel is the camelCase alias of get_comm_channel.