[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: NEWBIE Question: LUA wait() function?
- From: Peter Odding <xolox@...>
- Date: Wed, 12 Mar 2008 02:19:44 +0100
(Hit [Send] too soon)
Note that the repeat until loop is called a busy loop* which Wikipedia
calls a `naïve attempt at programming' :). The reason I posted it is
that it's the only way to wait in plain Lua (I think...)
Peter Odding wrote:
I think Lua doesn't have os.sleep() (the name usually given) because
it's not in the C standard. There's a way around it in plain Lua,
assuming os.time() uses seconds as its unit (which is the case on at
least Windows and Linux):
local start = os.time()
repeat until os.time() > start + seconds
for i=1,10 do
Off-topic: The keywords in your code are capitalized though keywords in
Lua are case sensitive. Just so you know.
Sorry for a newbie question. I am not a programmer, but I have just
started to use LUA in an application that supports LUA scripts.
I need a pause or wait command inside my script;
For i=1,10 do
In this script I would print “i” every 7 sec. Is there such a simple
wait command included in LUA?
Surprised if there is not…?
I searched the LUA archive, but only found discussions about
coroutine.yield(). However, I do not understand how to use this or if
they can even be called in the application that I am using (EccoExt
for Ecco Pro. See the Tutorials here http://eccowiki.com/)