[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: C Timers and Lua functions
- From: "Virgil Smith" <Virgil@...>
- Date: Thu, 3 Jun 2004 15:29:12 -0500
For a canned system for generating/recycling keys, just use lua_ref.
[mailto:email@example.com]On Behalf Of Jeffrey Drake
Sent: Thursday, June 03, 2004 1:13 PM
Subject: C Timers and Lua functions
-----BEGIN PGP SIGNED MESSAGE-----
In my project I need to add support for a variable number of timers.
These timers would each call a lua function registered with it.
There are two potential implementations I can envision:
#1: Create the timer and store the lua function in the user info of the
#2: Create the timer, storing a key to the registry that will contain
the function to be called. Timer stores key in user info.
#1 is the most optimal, but there doesn't seem to be a way to take a
function off of the stack.
#2 is easily done, but I have to get into resource management of x
number of timers possible
For the first method, the only way I can think of is xmove, from one
stack to another. This is probably more intensive then I want.
For the second method, the only thing I can think of there is having a
base key for timers, and add onto that. As each one shot timer is
invalidated then it is set to nil at that key and then the next timer
must search that space for a free timer.
Any input on how to do this, another option, implementing #1 cheaply,
Just for platform information - I am planning on porting it to other
platforms but at this time it is purely Cocoa and C.
"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
- - Referring to King Mongkut of Siam
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
-----END PGP SIGNATURE-----