[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Interaction of os calls and \r Partial answer
- From: Jose Torre-Bueno <jtorrebueno@...>
- Date: Tue, 14 May 2013 14:31:38 -0700
On May 14, 2013, at 2:20 PM, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
> Can anyone explain why this code produces a line on the console that ticks up every second:
>
> function testw()
> while true do
> t = os.time()
> io.write(t, '\r')
> end
> end
>
>
> But this code produces nothing:
>
> function testw()
> while true do
> t = os.time()
> io.write(t, '\r')
> while os.time() == t do
> io.write('')
> end
> end
> end
>
I have a partial answer. This code behaves as expected:
function testw()
while true do
t = os.time()
io.write(t, '\r')
io.stdout:flush()
os.execute('sleep 1')
end
end
The question remains why does an os call create a need to flush the stdout buffer?
Jose Torre-Bueno
jtorrebueno@cox.net