AcediaDocumentation

create_comm_channel

Creates a local communication channel and registers its delivery callback.

Returns a numeric ID and a channel object with Id, Event and Fire. It registers the delivery callback, then takes the channel table the native owns for that ID in this VM and adds Event to it, so the object it returns is the same one get_comm_channel answers with.

See CommChannel for the object’s members.

create_comm_channel(): (number, CommChannel)

Example

local id, channel = create_comm_channel()
channel.Event:Connect(function(value) print(value) end)
channel:Fire("example")

Example output

example

The handler runs on whichever VM listens on this channel; here the current VM is both sender and listener.

Aliases: createcommchannel.

On this page