rednet_message event

From ComputerCraft
Jump to: navigation, search
rednet_message
Event
Returns
  • id : number The supposed ID of the sender.
  • msg : any The message.
  • protocol? : string The specified protocol. Prior to ComputerCraft 1.6, was the distance between sender and reciever.

Source CC:Tweaked

Triggered by the rednet coroutine and is created from the modem_message event. For most use cases, rednet.receive is usually easier to use.

ExampleExamplePrint messages
Prints messages received through rednet. Requires that there is a modem open for rednet to use.
Code
while true do
  local event, senderId, message, protocol = os.pullEvent("rednet_message")
  print("Computer", senderId, "sent a message", message, "with the", protocol, "protocol!")
end