View difference between Paste ID: AXaMb9YZ and e1hmeMqw
SHOW: | | - or go back to the newest paste.
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
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