lua-users home
lua-l archive

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

Hash: SHA1

I am making a program that I am trying to change the (lua) API in to make it better suited for evolution.

The program is rather like glut is, but written using Cocoa's API (objective-c / mac) to host it, but still opengl. Lua runs the actual scripts.

Right now the events work similar to glut.

A trimmed down example:
- --
function reshape(w,h)

- --

What happens is that it will load up the module an execute it, so that the functions become registered. Then the script essentially is done until an event is fired by resizing the window.

This is fine for basic stuff, but I want to make it more like how windows does it.

A hypothetical example:

- -- performed in a loop
e = Event.GetEvent()

if e.type == WM_RESIZE then
- --

The key being GetEvent.

Where the magic here is, and I am hoping can be done in some way...

GetEvent 'blocks' until an event is received, in exactly the same way as the original example worked.

From my limited exposure to other languages continuations would work here if they were available :-). It has been suggested coroutines might be the way, but I do not know even of that.

:-) Merci pour l'assistance

- - Jeff

"Reportedly, he remarked to one of his Christian missionary friends: 'What you teach us to do is admirable, but what you teach us to believe is foolish'."
- - Referring to King Mongkut of Siam
Version: GnuPG v1.2.4 (Darwin)