[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: write to same line on standard out?
- From: Jorge <xxopxe@...>
- Date: Wed, 14 Jul 2010 16:17:58 -0300
On Wed, 2010-07-14 at 16:08 -0300, Luiz Henrique de Figueiredo wrote:
> Try
> for i=1,100 do
> io.write(i,"\r"); io.flush(); os.execute"sleep 1"
> end
>
> (I just wonder why this loop cannot be broken with ^C.)
The Ctrl-C is only aborting the sleep, you have to be very lucky to
ctrl-c to be caught by Lua bit. You have to do something like
if os.execute("sleep 1") ~= 0 then break end