DelAllChild

Constructor:

DelAllChild()

Description

This function deletes all child objects of the object. If the developer does not want to delete all child objects, GetAllChild or GetAllDescendant can be used to iterate through child objects and select the objects that needs to be deleted.

Examples

This example will create two folders. Clone a part twice to folder1 and name them 1 and 2, and clone the part twice to folder2 and name them 3 and 4. Delete all child objects under folder1 via DelAllChild, that is, delete all parts under folder1.

local temp = RWObject.Create("Part") -- create an instance object of the part
temp.Position = Vector3.New(3,3,3) -- set the coordinates for the created part object
temp.Parent = WorkSpace
local temp2 = RWObject.Create("Folder") -- create folder1
temp2.Name = "folder1"
temp2.Parent = WorkSpace
local temp3 = RWObject.Create("Folder") -- create folder2
temp3.Name = "folder2"
temp3.Parent = WorkSpace
for i = 1,2 do -- make two copies of the part and put them under folder1
    temp1 = temp:Clone()
    temp1.Name = tostring(i)
    temp1.Parent = temp2
end
for i = 3,4 do -- make two copies of the part and put them under folder2
    temp1 = temp:Clone()
    temp1.Name = tostring(i)
    temp1.Parent = temp3
end
temp2:DelAllChild() -- delete all child objects under folder1