[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: GC method for objects
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Tue, 19 Apr 2005 10:42:25 -0300
On 4/19/05, Roberto Ierusalimschy <email@example.com> wrote:
> Since this userdata is dummy anyway, you can store the table as the
> userdata's metatable. Lua 5.1 offers a more proper way to do this
> But I think Luacom already builds userdata to represent COM objects,
> doesn't it? Can't you attach the __gc on them?
LuaCOM uses a table with a userdata in one of its keys. The key is
_USERDATA_REF. These userdata already have a metatable with __gc (to
call Release on the COM object, among other things). So if you change
the metatable, remember to call the original __gc.
> -- Roberto