Deleting types within types question.
Blitz3D Forums/Blitz3D Beginners Area/Deleting types within types question.
| ||
This is something that has been bugging me for a while, but I don't know the correct answer. let's say I have a type inside another type, like this type vector2 field x# field y# end type type obj field pos.vector2 end type o.obj = new obj o\pos = new vector2 o\pos\x = 1 o\pos\y = 2 Now when I want to delete the type, I do this delete o\pos delete o but do I need to delete the sub-type, or can I just use the following? delete o |
| ||
The first method is the correct one. The second method will cause a memory leak and vector2 types will still be hanging around. Obviously, if you delete all vector2's first you don't need to touch the pos.vector2 as the type instance it points to is already gone. |
| ||
Thanks. I just realized it was pretty easy to see by just doing this. |
| ||
Woah, I was just wondering yesterday if putting a type within a type is possible. Thanks for saving me some time ;) |