Code: Select all
Structure object
id.l
parent.l
EndStructure
Global NewList objects.object()
ResetList(objects())
AddElement(objects())
objects()\id = 1
objects()\parent = 0
ResetList(objects())
AddElement(objects())
objects()\id = 2
objects()\parent = 1
ResetList(objects())
AddElement(objects())
objects()\id = 3
objects()\parent = 2
Procedure delete_object(id.l)
ForEach objects()
If objects()\id = id
DeleteElement(objects())
ElseIf objects()\parent = id
delete_object(objects()\id)
EndIf
Next
EndProcedure
delete_object(2)
ForEach objects()
Debug "ID: " + Str(objects()\id) + " :: Parent: " + Str(objects()\parent)
Next
