Guest User

test2

a guest
Mar 12th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. tank = peripheral.wrap("rcsteeltankvalvetile_0")
  2. bridge = peripheral.wrap("right")
  3. mc = 1
  4. --bridge.addText(1,1)
  5. local function opairs(_t)
  6.   local keys = {}
  7.   for k in pairs(_t) do
  8.     table.insert(keys,k)
  9.   end
  10.   table.sort(keys)
  11.   local index = 0
  12.   return function()
  13.     index = index + 1
  14.     local key = keys[index]
  15.     return key,_t[key]
  16.   end
  17. end
  18.  
  19.  
  20.  
  21.  
  22. _tf = tank.getTankInfo("unknown")
  23. for x,y in pairs(_tf) do
  24.   for x2,y2 in pairs(y) do
  25.  
  26.     if x2 == "rawName" then
  27.       ntu = y2
  28.     end
  29.  
  30.     if x2 == "amount" then
  31.       amta = y2
  32.     end
  33.  
  34.     if x2 == "capacity" and y2 ~= 20 then
  35.       cpta = y2
  36.     end
  37.   end
  38. end
  39.     perc = math.floor(amta / cpta * 100).."%"
  40.  
  41.  
  42.  
  43.  
  44.    
  45.    
  46.     toadd = {
  47.       ["name"]=ntu,
  48.       ["amount"]=amta,
  49.       ["capacity"]=cpta,
  50.       ["percent"]=perc}
  51.     for k,v in opairs(toadd) do
  52.       bridge.addText(1,mc,k..": "..v,1160255)
  53.       mc = mc + 8
  54.     end
  55.  
  56.  
  57.  
  58. --if cpta ~= nil and amta ~= nil then print(cpta..amta) end
Advertisement
Add Comment
Please, Sign In to add comment