Advertisement
Guest User

thing

a guest
Jan 11th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local component = require("component")
  2. local os = require("os")
  3. local term = require("term")
  4.  
  5.  
  6. function checkBatt()
  7. curr = 0
  8. for addr, name in (component.list("capacitor_bank")) do
  9. battcheck = component.proxy(addr).getEnergyStored()
  10. curr = curr + battcheck
  11. end
  12. return curr
  13. end
  14.  
  15. function getMaxBatt()
  16. max = 0
  17. for addr, name in (component.list("capacitor_bank")) do
  18. maxcheck = component.proxy(addr).getMaxEnergyStored()
  19. max = max + maxcheck
  20. end
  21. return max
  22. end
  23.  
  24. function updateMon(curr, max)
  25. term.clear()
  26. term.setCursor(1,1)
  27. io.stdout:write(curr .. "/" .. max .. " RF Stored.")
  28. return
  29. end
  30.  
  31. while true do
  32.  
  33. max = getMaxBatt()
  34. curr = checkBatt()
  35. updateMon(curr, max)
  36. os.sleep(1)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement