Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- os.loadAPI("ocs/apis/graph")
- local sensor = peripheral.wrap("back")
- -- get basic details of the targets the sensor has detected
- local targets = sensor.getTargets()
- -- loop through them
- for name, details in pairs(targets) do
- print("Found a target of type "..details["type"])
- print("Details:")
- -- get full details for the current target
- local fulldetails = sensor.getTargetDetails(name)
- -- print out each detail one by one
- for key, value in pairs(fulldetails) do
- print(key..": "..tostring(value))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement