AddObject - how to remove objects ?

We are using the TatScripter.AddObject to register objects. In some cases we need to exchange the registered objects. I. e. we need to delete the object and create it newly.
What would be the appropriate method to deregister the object ? There's no RemoveObject. Would RemoveProperty be suitable ? Or can we simply use AddObject to re-register the new object with the same AName ?

Rainer Woehrle

Hello,

yes, RemoveProperty will do the job. Calling AddObject again will also do the job.
You can have a third option which would be registering the object with DefineProp instead of AddObject. This way you define a getter function for the property and then you don't need to remove or re-register anything, just return whatever object you want from that function.

Thanks a lot.
Are you saying that the use of RemoveProperty and AddObject are equivalent ? Or is it better to use RemoveProperty first and then re-register by AddObject again. In other words: Does the redo of AddObject do the same 'internal cleanup' as the RemoveProperty ?

Many thanks
Rainer

It's equivalent, there is no cleanup.