Teutatis

Example2

Apr 24th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 sensor name
  14.   print (prox.getSensorName())
  15.  
  16.   -- print target name
  17.   print("Found entity: "..name)
  18.  
  19.   -- get more details about them
  20.   local moreDetails = prox.getTargetDetails(name)
  21.  
  22.   -- print their health
  23.   print("Health: "..moreDetails.Health)
  24.  
  25.   print("------")
  26. end
Advertisement
Add Comment
Please, Sign In to add comment