owenh28

b

Jan 12th, 2022
852
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local modem = peripheral.find("modem", rednet.open)
  2. local printer = peripheral.find("printer")
  3. local px, py
  4. if rednet.isOpen(modem) then
  5.     print("Modem is innitiated")
  6. else
  7.     printError("Problem or something")
  8. end
  9. rednet.host("main", "router")
  10. -- Making 0xa an identifier for a computer that has just joined network
  11. rednet.broadcast("0xa-router")
  12.  
  13. print("Listing online hosts")
  14. local online = rednet.lookup("main")
  15. print(#online .. "Computers online")
  16. print("Listing computers online: ")
  17. for _, host in pairs(online) do
  18.     print(host)
  19.     px, py = printer.getCurserPos()
  20.     printer.write(host .. " ")
  21.     printer.setCurserPos(0, py+1)
  22. end
  23.  
Advertisement
Add Comment
Please, Sign In to add comment