Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- local gbattery = component.get("34a07","induction_matrix")
- local batterie = component.proxy(gbattery)
- function adjustUnit(value, unit) -- prevent big numbers
- if value >= 1000000000000 then
- return tostring(round(value/1000000000000, 2)) .. "T" .. unit
- elseif value >= 1000000000 then
- return tostring(round(value/1000000000, 2)) .. "G" .. unit
- elseif value >= 1000000 then
- return tostring(round(value/1000000, 2)) .. "M" .. unit
- elseif value >= 1000 then
- return tostring(round(value/1000, 2)) .. "k" .. unit
- else
- return tostring(round(value)) .. unit
- end
- end
- while true do
- print(adjustUnit(batterie.getEnergy, "RF"))
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement