lua-users home
lua-l archive

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


> Is there any way I can get rid of all the Lua proxies of a C++
> object I've deleted?

The easiest way is to use a double proxy. The first proxy delegates
to the second one; you release the first one to Lua. Then you can
replace the first proxy's proxy with a function that throws an error
or returns nil, or whatever.

However, I'm not sure if you are asking the right question. Perhaps
you would be better off taking advantage of Lua's garbage collector
and not deleting your C++ object until there are no references to
it left. That simply requires a __gc metamethod.

R.