- Joined
- Apr 27, 2008
- Messages
- 2,455
With lua, i suppose you're still using an unit indexer ?
and this custom unit value as a key of a list(s), where you can store other data ?
I wanted a native way in lua to detect when an unit is removed with weak tables and __gc method, but then i realized garbage collector isn't instant and because of the nature of an unit it wouldn't work anyway. (it might be no reference left to it, that doesn't mean you can't ref it again later :GroupEnum, nor that the unit should be destroyed
)
Of course if you control the whole units lifes in script the unit indexer doesn't need any "custom" way to detect when an unit is removed of the game.
and this custom unit value as a key of a list(s), where you can store other data ?
I wanted a native way in lua to detect when an unit is removed with weak tables and __gc method, but then i realized garbage collector isn't instant and because of the nature of an unit it wouldn't work anyway. (it might be no reference left to it, that doesn't mean you can't ref it again later :GroupEnum, nor that the unit should be destroyed
Of course if you control the whole units lifes in script the unit indexer doesn't need any "custom" way to detect when an unit is removed of the game.