QuickMuffin8782-Alt

Untitled

Nov 8th, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. local function drawProgBar(done, max)
  2.  
  3. local value = done / max
  4. local _, y = term.getCursorPos()
  5. local wide, _ = term.getSize()
  6. term.setCursorPos(1,y)
  7. term.clearLine()
  8. term.write(("="):rep(math.floor(value * (wide - 6))))
  9. term.setCursorPos(math.floor(value * (wide - 6))), y)
  10. term.write(">")
  11. term.setCursorPos(wide - 6, y)
  12. term.write("]")
  13. term.setCursorPos(1, y)
  14. term.write("[")
  15.  
  16. local percent = math.floor(value * 100) .. "%"
  17. term.setCursorPos(wide - percent:len(),y)
  18. term.write(percent)
  19.  
  20. end
Add Comment
Please, Sign In to add comment