modem_message event

Occurs every time a wireless message has been received by (wireless) modem that had the message's channel open.

ExampleReceiving modem messages
Wraps a connected modem peripheral, opens channel 123 and listens for incoming messages.
local modem = peripheral.find("modem")

while true do
  local event, peripheral_name, channel, replyChannel, message, distance = os.pullEvent("modem_message")
  print("Received a message on channel", channel, "at", distance, "blocks away.")
  print("The message: ", message)
  • name : string The side or network name of the wrapped Modem that received the message
  • channel : number The channel the message has been send on
  • channel : number The desired reply channel the sender specified
  • message : any The message's content
  • distance? : number The distance from the sender to the receiver, in meters/blocks. This will not be set if the modems are in different dimensions.

Source CC:Tweaked
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.