Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- peripherals = {}
- Monitor = peripheral.wrap("monitor_47")
- LineIndex = 1
- function drawCell(id, min, max, val)
- print(id .. " - Value = " .. val)
- LineIndex = LineIndex + 1
- end
- function drawCells()
- for k, v in pairs(peripherals) do
- drawCell(v.id, v.energyMin, v.energyMax, v.energyNow)
- end
- end
- function sortIt(a, b)
- return a.id < b.id
- end
- function main()
- for i, name in pairs(peripheral.getNames()) do
- if (peripheral.getType(name) == "cofh_thermalexpansion_energycell") then
- local perip = peripheral.wrap(name)
- peripherals[name] = {
- handle = perip,
- full_name = name,
- energyMin = 0,
- energyMax = perip.getMaxEnergyStored("UNKNOWN"),
- energyNow = perip.getEnergyStored("UNKNOWN"),
- id = tonumber(string.sub(name, 34, string.len(name)))
- }
- end
- end
- table.sort(peripherals, sortIt)
- Monitor.clear()
- Monitor.setCursorPos(1,1)
- LineIndex = 1
- drawCells()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement