MatthewGB

LUA OpenSensors

Jan 27th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. -- load the API
  2. os.loadAPI("ocs/apis/sensor")
  3.  
  4. -- wrap the sensor
  5. prox = sensor.wrap("bottom")
  6. m = peripheral.wrap("top")
  7.  
  8. -- get the targets
  9. local targets = prox.getTargets()
  10.  
  11. -- loop through them
  12. for name, basicDetails in pairs(targets) do
  13.  
  14. -- print their name
  15. print("Found entity: "..name)
  16.  
  17. -- get more details about them
  18. local md = prox.getTargetDetails(name)
  19.  
  20. if md.MaxStorage == "" then
  21. print ""
  22. else
  23. m.write("Stored: ")
  24. m.write(md.MaxStorage)
  25. m.write("/")
  26. end
  27. sleep(0.5)
  28. end
Advertisement
Add Comment
Please, Sign In to add comment