lua-users home
lua-l archive

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


I am indeed writing several "macros" that are manipulating data in Ecco Pro
(Ecco Pro is Personal Information Manager). However, I have a need for a
wait/pause/sleep function in order to periodically check if some data has
changed. 

I also intended to use it to periodically execute actions at predetermined
times.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of KHMan
Sent: Tuesday, March 11, 2008 7:08 PM
To: Lua list
Subject: Re: NEWBIE Question: LUA wait() function?

Peter Odding wrote:
> (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
> 
> * http://en.wikipedia.org/wiki/Busy_loop

Assuming Rolf is exclusively using Lua on EccoExt...

>From the Ecco wiki site mentioned below, Ecco, a Win32 app, sounds
like a kind of spreadsheet. The Lua examples there
(http://eccoextdoc.wikispaces.com/Sample+LUA+Programs) looks much
like macros one would write using Excel VB. If EccoExt's Lua can't
be extended using DLLs, then we're stuck with a busy loop method.

Fundamentally, I think there is no practical need for a wait
function, since the intended programming model is much like Excel
VM macros. I took a look at EccoPy, there are no event-driven
functions or things like that, but one can create or open
worksheets, etc., in addition to tabulated data functions.

At first glance, it looks like we can't do any interactive or
timelined stuff, so it is more for advanced data processing and
macro tasks -- you execute a Lua script to get some non-trivial
processing or tasks done. So with EccoExt, perhaps one should
start by focusing on writing scripts that do simple processing
tasks instead, as I did with Excel VB. Please correct me if I am
wrong.

> 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):
>>
>>> [snip]
>>>
>>> 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/)
>>>
>>> TIA!!

-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia