CodeCrafter

sensor

May 1st, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. -- load the API
  2. os.loadAPI("ocs/apis/sensor")
  3.  
  4. -- wrap the sensor
  5. prox = sensor.wrap("left")
  6.  
  7. -- get the targets
  8. local targets = prox.getTargets()
  9.  
  10. -- loop through them
  11. for name, basicDetails in pairs(targets) do
  12.  
  13. -- print their name
  14. print("Found entity: "..name)
  15.  
  16. -- get more details about them
  17. local moreDetails = prox.getTargetDetails(name)
  18.  
  19. -- print their health
  20. print("Health: "..moreDetails.Health)
  21.  
  22. print("------")
  23. end
Add Comment
Please, Sign In to add comment