diff options
author | Jin Hwa Kim <jnhwkim@gmail.com> | 2016-02-27 10:38:39 +0300 |
---|---|---|
committer | Jin Hwa Kim <jnhwkim@gmail.com> | 2016-02-27 10:38:39 +0300 |
commit | 87ae1f554b85c661ddae32a79afd514c899eea2c (patch) | |
tree | 418bbad508e53b263a882460de5499587fdf19ac | |
parent | ab8ffadd0df03ebdacb6abc2c049216310217e1a (diff) |
fix to center align of a progress indicator
th -e 'for i =1,100 do xlua.progress(i,100) end'
[============= 100/100 ===========>] Tot: 0ms | Step: 0ms
-rw-r--r-- | init.lua | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -284,13 +284,14 @@ do end -- Print remaining time when running or total time when done. if (percent < barLength) then - io.write('ETA: ' .. formatTime(remaining)) + tm = ' ETA: ' .. formatTime(remaining) else - io.write('Tot: ' .. formatTime(elapsed)) + tm = ' Tot: ' .. formatTime(elapsed) end - io.write(' | Step: ' .. formatTime(step)) + tm = tm .. ' | Step: ' .. formatTime(step) + io.write(tm) -- go back to center of bar, and print progress - for i=1,6+#tm+barLength/2 do io.write('\b') end + for i=1,5+#tm+barLength/2 do io.write('\b') end io.write(' ', current, '/', goal, ' ') -- reset for next bar if (percent == barLength) then |