Advertisement
Guest User

PeripheralConnector

a guest
Nov 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. local sides = {"top","bottom","left","right"
  2. ,"front","back"}
  3. local perfs = {"none","none","none","none","none","none"}
  4. local channel = 0
  5. for i = 1, #sides do
  6.  if peripheral.isPresent(sides[i]) then
  7.     print(peripheral.getType(sides[i]).." found on side"..sides[i])
  8.     perfs = peripheral.getType(sides[i])
  9.   end
  10.  if peripheral.getType(sides[i]) == "modem" then
  11.     local modem = peripheral.wrap(sides[i])  
  12.     print("Type port number you wish to connect to for modem on side"..sides[i])
  13.     channel =  read()
  14.     print("Establishing connection on port"..channel)
  15.     perfs[i] = pheripheral.wrap(sides[i])
  16.     modem.open(channel)
  17.     print("Connection with Port"..channel.."successfull!")
  18.  end  
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement