Advertisement
fimas

find_dev

Sep 5th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. -- Find
  2. -- Finds devices connected to console
  3.  
  4. -- @local var peripherals
  5. -- Saves where and what is present
  6. local preipherals = {}
  7.  
  8. -- Find peripherals
  9. local function find_peripherals()
  10.     local peripherals = {}
  11.     for _,s in pairs(rs.getSides()) do
  12.         if peripheral.isPresent(s) then
  13.             peripherals[s] = peripheral.getType(s)
  14.         else
  15.             peripherals[s] = " "
  16.         end
  17.     end
  18.    
  19.     return peripherals
  20. end
  21.  
  22. peripherals = find_peripherals()
  23.  
  24. for _,s in pairs(rs.getSides()) do
  25.     print(s..": "..peripherals[s])
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement