Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getDevices(deviceType)
- local deviceName = nil
- local deviceIndex = 1
- local deviceList, deviceNames = {}, {}
- local peripheralList = peripheral.getNames()
- deviceType = deviceType:lower()
- for peripheralIndex = 1, #peripheralList do
- if (string.lower(peripheral.getType(peripheralList[peripheralIndex])) == deviceType) then
- printLog("Found "..peripheral.getType(peripheralList[peripheralIndex]).."["..peripheralIndex.."] as index \"["..deviceIndex.."]\" attached as \""..peripheralList[peripheralIndex].."\".")
- deviceNames[deviceIndex] = peripheralList[peripheralIndex]
- deviceList[deviceIndex] = peripheral.wrap(peripheralList[peripheralIndex])
- deviceIndex = deviceIndex + 1
- end
- end
- return deviceList, deviceNames
- end
- getDevices("appeng_ae_tilecontroller")
- getDevices("cofh_thermalexpansion_energycell")
- getDevices("openperipheral_glassesbridge")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement