lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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