Advertisement
xeritt

OpenComputers broadcast send

Sep 3rd, 2018
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local event = require("event")
  3. local arg = {...}
  4. local m = component.modem -- get primary modem component
  5. m.open(225)
  6. print(m.isOpen(225)) -- true
  7.     -- Send some message.
  8. m.broadcast(225, arg[1])
  9.  -- Wait for a message from another network card.
  10. local _, _, from, port, _, message = event.pull("modem_message")
  11. print("Got a message from " .. from .. " on port " .. port .. ": " .. tostring(message))
  12.  
  13. local _, _, from, port, _, message = event.pull("modem_message")
  14. print("Got a message from " .. from .. " on port " .. port .. ": " .. tostring(message))
Advertisement
RAW Paste Data Copied
Advertisement