Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Change the side to correspond to the side of the Info Reader
- m = peripheral.wrap("right")
- local energy = {}
- local names = {}
- local current = 0
- local max = 0
- local function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- for i = 1,9 do
- local id,state,title,data = m.get(i)
- --comment out the "title = i" line if your cards have names
- title = i
- names[i] = title
- energy[i] = data
- end
- for l = 1,#energy do
- for i,j in pairs(energy[l]) do
- if i == "energyL" then
- print("Storage "..names[l]..": "..j)
- current = current + j
- elseif i == "maxStorageL" then
- max = max + j
- end
- end
- end
- local percent = current/max*100
- print("Total: "..tostring(current).." / "..tostring(max))
- print("Percentage Full: "..round(percent, 0).."%")
Advertisement
Add Comment
Please, Sign In to add comment