Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function drawProgBar(done, max)
- local value = done / max
- local _, y = term.getCursorPos()
- local wide, _ = term.getSize()
- term.setCursorPos(1,y)
- term.clearLine()
- term.write(("="):rep(math.floor(value * (wide - 6))))
- term.setCursorPos(math.floor(value * (wide - 6)), y)
- term.write(">")
- term.setCursorPos(wide - 6, y)
- term.write("]")
- term.setCursorPos(1, y)
- term.write("[")
- term.setCursorPos(wide - 5, y)
- term.write(" ")
- local percent = math.floor(value * 100) .. "%"
- term.setCursorPos(wide - percent:len(),y)
- term.write(percent)
- end
- local x, y = term.getCursorPos()
- local maxNum = math.random(1, 500)
- print(maxNum)
- for i = 1, maxNum do
- term.setCursorPos(1,y+1)
- drawProgBar(i, maxNum)
- print()
- sleep(0.01)
- end
- sleep(1)
Add Comment
Please, Sign In to add comment