TheGameBoy_95

Untitled

May 20th, 2019
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. os.loadAPI("ocs/apis/graph")
  3. local sensor = peripheral.wrap("back")
  4. -- get basic details of the targets the sensor has detected
  5. local targets = sensor.getTargets()
  6. -- loop through them
  7. for name, details in pairs(targets) do
  8.  
  9. print("Found a target of type "..details["type"])
  10. print("Details:")
  11.  
  12. -- get full details for the current target
  13. local fulldetails = sensor.getTargetDetails(name)
  14.  
  15. -- print out each detail one by one
  16. for key, value in pairs(fulldetails) do
  17. print(key..": "..tostring(value))
  18. end
  19.  
  20. end
RAW Paste Data