lua-users home
lua-l archive

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


Um, approach what?
You stated that you would like to keep a master table of these objects and
then dereference them so that they could be collected.

What you have not stated is why you would want to take such a drastic
measure as ripping an object away from other objects that are referencing
it.

Perhaps you could make an event notification system so that the affected
objects would be notified of whatever event triggered the need to "make the
object go away", then they could release their references.

If you simply cannot trust these objects to release all of their references
after such a notification, you could then invalidate the object as I
previously suggested.


Implementing an "event system" in Lua is simply a matter of adding functions
to a list style table so that you can call them back at the time of the
event.  You can pass the event callback function whatever you like (in this
case perhaps a reference to the object to be destroyed).


-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Michael Cumming
Sent: Tuesday, July 27, 2004 5:48 AM
To: lua@bazar2.conectiva.com.br
Subject: Re: table question


Ryan, Virgil.

Thanks you for your responses.  When using the LuaCom library, open COM
objects are only disposed once all references to the object removed and
the garbage collector is called.  With the environment that I am using
Lua, I would like to have a master table that could keep track of these
objects and then dereference them so that they can be collected.  Do you
have any better suggestions as a way to approach this?

Mike

<<attachment: winmail.dat>>