[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: NEWBIE Question: LUA wait() function?
- From: "Rolf" <rb@...>
- Date: Tue, 11 Mar 2008 19:24:15 -0700
Thanks for all the responses. I think that I forgot to mention that I am
running windows (XP);
1. I tried sleep() and os.sleep, but it didn't work.
2. I don't think that I can add any libraries because LUA is somehow
built-in into the EccoExt executable (LUA is not separately installed).
3. I tried the suggested:
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
for i=1,10 do
print(i)
wait(7)
end
However, the CPU is going at close to 100% (as also mentioned) so that is
not a viable option.
4. I also tried:
for i=1,10 do
print(i)
if os.execute("/bin/sleep 7") ~= 0 then break end
end
However, after the first print(i), the cmd window opened and closed and the
loop stopped.
So in summary, I guess that there is no way to pause for a time without
having the CPU close to 100%...?
p.s. I do not have a print command, but I am using msgbox(i) to check the
"wait()" function.
-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Jorge Visca
Sent: Tuesday, March 11, 2008 7:04 PM
To: Lua list
Subject: Re: NEWBIE Question: LUA wait() function?
For the ugly competition:
for i=1,10 do
print(i)
if os.execute("/bin/sleep 7") ~= 0 then break end
end
(the if ... break is for catching ctr-c while waiting)
:)