Advertisement
buffsovernexus

Untitled

May 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. --Test
  2. function findModem()
  3. local periList = peripheral.getNames()
  4.  
  5. for i = 1, #periList do
  6. if peripheral.getType(periList[i]) == "modem" then
  7. return periList[i]
  8. end
  9. end
  10. return nil
  11. end
  12.  
  13.  
  14.  
  15. local side = findModem()
  16.  
  17. if rednet.isOpen(side) then
  18. rednet.host("modems", "modem" .. os.getComputerID())
  19. else
  20. rednet.open(side)
  21. rednet.host("modems", "modem" .. os.getComputerID())
  22. end
  23.  
  24. local modemIds = {rednet.lookup("modems")}
  25. for i=1,#modemIds do
  26. print("Found a server on channel "..modemIds[i].."!")
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement