Advertisement
NolanSyKinsley

Untitled

Apr 3rd, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. local function getDevices(deviceType)
  2. local deviceName = nil
  3. local deviceIndex = 1
  4. local deviceList, deviceNames = {}, {}
  5. local peripheralList = peripheral.getNames()
  6.  
  7. deviceType = deviceType:lower()
  8.  
  9. for peripheralIndex = 1, #peripheralList do
  10.  
  11. if (string.lower(peripheral.getType(peripheralList[peripheralIndex])) == deviceType) then
  12. printLog("Found "..peripheral.getType(peripheralList[peripheralIndex]).."["..peripheralIndex.."] as index \"["..deviceIndex.."]\" attached as \""..peripheralList[peripheralIndex].."\".")
  13. deviceNames[deviceIndex] = peripheralList[peripheralIndex]
  14. deviceList[deviceIndex] = peripheral.wrap(peripheralList[peripheralIndex])
  15. deviceIndex = deviceIndex + 1
  16. end
  17. end
  18.  
  19. return deviceList, deviceNames
  20. end
  21.  
  22. getDevices("appeng_ae_tilecontroller")
  23. getDevices("cofh_thermalexpansion_energycell")
  24. getDevices("openperipheral_glassesbridge")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement