[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: NEWBIE Question: LUA wait() function?
- From: gary ng <garyng2000@...>
- Date: Tue, 11 Mar 2008 19:59:48 -0700 (PDT)
if os.execute() works, it would be something like :
os.execute("c:\sleep.exe 10") where you just find a
very simple C program(or whatever language, python, or
even another lua script using the stand alone lua +
alarm() module) which do the delay for you.
the idea is, call a program that can sleep/delay for X
seconds.
--- Rolf <rb@san.rr.com> wrote:
> I tried this:
> function test()
> for i=1,3 do
> result=os.execute()
> msgbox(result)
> end
> end
>
> The message box showed "1" (3 times).
> How would I use this as a pause function?
>
> p.s. No, I can not use VBA, only LUA.
>
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br] On
> Behalf Of gary ng
> Sent: Tuesday, March 11, 2008 7:39 PM
> To: Lua list
> Subject: RE: NEWBIE Question: LUA wait() function?
>
> can you do os.execute() ? if yes, that may be the
> only
> non-busy way as you can use some 'sleep' utility
> programs.
>
> --- Rolf <rb@san.rr.com> wrote:
>
> > 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)
> >
> > :)
> >
> >
>
>
>
>
>
____________________________________________________________________________
> ________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
>
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping