Not quite familiar with this coming from B3D
Ok in simple talk. In B3D when you create an object using New, you have to remove it using Delete at some point. In BM, this is done automatically. You don't need to worry about deleting objects after use.
Would I use this to free an objects handle?
They are not called "handles" anymore, they are "ordinary" variables. But they work in a similar way. When you want an object's handle (or variable holding its reference, for proper-speak) to be free, you just say MyObject = Null. If the object that MyObject used to be referring to no longer has any other references (or handles), it is deleted automatically.
I want the object to exists still, I just would like to use its handle for another object
Strict
Local handle1:MyType
Local handle2:MyType
handle1 = New MyType
handle2 = handle1
'now both refer to same object
handle1 = Null
'only handle2 refers to the original object
handle1 = New MyType
'both handles refer to unique objects now. Advice: make sure to use Strict or SuperStrict mode, to increase efficiency of the garbage collector.
|