Advertisement
Clor

GregEUCounter

Mar 16th, 2016
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. local c = require("component")
  2. local term = require("term")
  3. local shell = require("shell")
  4. local gpu = c.gpu
  5. local screenWidth, screenHeight = gpu.getResolution()
  6. local pt = {}
  7. local n = 0
  8. local flag = true
  9. local args, options = shell.parse(...)
  10. --------------------
  11. gpu.fill(1, 1, screenWidth, screenHeight, ' ')
  12. term.setCursor(1,1)
  13. if #args < 1 then
  14.     print("filter default machine hull only")
  15.     for k,v in c.list("hull") do       
  16.         n = n + 1      
  17.         print("======== ".."COUNTER "..n.." ========")
  18.         print("adress: "..k.."  ".."type: "..v)
  19.         print("Input ".."         ".." eu/t average in 5 ticks")
  20.         print("Output ".."         ".." eu/t average in 5 ticks")
  21.         pt[n] = c.proxy(k)
  22.     end
  23. else
  24. print("custom filter")
  25.     for i = 1,#args do     
  26.         for k,v in c.list(tostring(args[i])) do        
  27.             n = n + 1          
  28.             print("======== ".."COUNTER "..n.." ========")
  29.             print("adress: "..k.."  ".."type: "..v)
  30.             print("Input ".."         ".." eu/t average in 5 ticks")
  31.             print("Output ".."         ".." eu/t average in 5 ticks")
  32.             pt[n] = c.proxy(k)
  33.         end
  34.     end
  35. end
  36.  
  37. while flag do  
  38.     for i=1,n do
  39.         gpu.set(7,i*4,"         ")
  40.         gpu.set(8,i*4+1,"         ")
  41.         gpu.set(7,i*4,tostring(pt[i].getAverageElectricInput()))
  42.         gpu.set(8,i*4+1,tostring(pt[i].getAverageElectricOutput()))
  43.     end
  44.     os.sleep(1)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement