lua-users home
lua-l archive

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

hi all, I have meet another problem :(

say, I have two userdata, A and B, and A has reference against B, you can treat A as B's parent. I want:
- if A is collecting, collect the B, either.
- don't collect B if B is referenced by A.

I know I can make a table in registry to record the dependence of A and B, but it wastes memory, and you can't collect the memory in a table has dead-key, even it's a weak table! So is there any other way to tell lua this dependence?

note that I need use the env table of A and B, so I can't record it in the env table.