lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 timer #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, etc.

Just for platform information - I am planning on porting it to other platforms but at this time it is purely Cocoa and C.

Regards,
Jeffrey Drake

"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
http://en.wikipedia.org/wiki/Mongkut
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFAv3hK0noMGorKkKgRAv3BAKCBcnDxSgxHgQzwHSzqRk83pbz+iACfbLVQ
pKeANJVJnssrstyNOxtxjDQ=
=ndtg
-----END PGP SIGNATURE-----