createcommchannel() / create_comm_channel()
Creates a cross-actor communication channel and returns its id and object.
Syntax
createcommchannel() -> number, { Fire: function, Event: any }
Parameters
No parameters.
Returns
| Type | Description |
|---|---|
number | Channel id usable from any actor state. |
table | Channel object with Event signal and Fire method. |
Description
Creates a channel stored in a process-wide registry. The returned table exposes Event (a Yuari Signal with Connect/Once/Wait) and Fire(...), which schedules the fire back on the creating state.
getcommchannel can recover the channel from another actor and fire it; instance and primitive arguments are transferred between states.
Example
local id, channel = createcommchannel()
channel.Event:Once(function(message)
print(message)
end)
Notes
- createcommchannel is the camelCase alias of create_comm_channel.