Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getDeviceSide(device)
- dSide = nil
- local dName = device
- if dName == "monitor" then
- dName = "monitor"
- elseif dName == "modem" then
- dname = "modem"
- else
- error("No Device Named: " .. device)
- end
- -- Determine where device is.
- print("Looking for device,")
- if peripheral.isPresent("left") and peripheral.getType("left")==dName then
- dSide = "left"
- elseif peripheral.isPresent("right") and peripheral.getType("right")==dName then
- dSide = "right"
- elseif peripheral.isPresent("top") and peripheral.getType("top")==dName then
- dSide = "top"
- elseif peripheral.isPresent("back") and peripheral.getType("back")==dName then
- dSide = "back"
- elseif peripheral.isPresent("bottom") and peripheral.getType("bottom")==dName then
- dSide = "bottom"
- else
- print("No " .. device )
- return
- end
- print(dName .. " found on "..dSide)
- return dSide
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement