GetAllDescendant

Constructor:

GetAllDescendant()

Description

Returns an array (a number index table) that contains the child objects of all hierarchies. This array is generated by recursively searching the object's child nodes of all hierarchies. The array can be iterated over by using a number or a general for-loop.

Return Value

Type Description
table Table that contains all child objects of all hierarchies

Examples

Find all part subclasses in WorkSpace, and change their colors.

local temp = RWObject.Create("Part") -- create an instance "temp" of Part
local temp2 = RWObject.Create("Folder") -- create an instance temp2 of the folder
local temp3 = RWObject.Create("Folder") -- create an instance temp3 of the folder
temp.Position = Vector3.New(3,3,3) -- set the coordinates of temp
for i = 1,4 do -- loop 4 times
    temp1 = temp:Clone() -- create a clone temp1 of temp
    temp1.Name = tostring(i) -- set temp1 as a loop variable
    temp1.Parent = temp2 -- set the parent of temp1 as temp2
end
for i = 1,4 do
    temp1 = temp:Clone()
    temp1.Name = tostring(i)
    temp1.Parent = temp3 -- set the parent of temp1 as temp3
end
for _,Child in pairs(WorkSpace:GetAllDescendant()) do -- traverse the array that is generated by using WorkSpace:GetAllDescendant()
    Child.Color = Vector3.New(255,255,0)
end