GetChildren (Function): Difference between revisions
From Goodblox Wiki
Jump to navigationJump to search
mNo edit summary |
mNo edit summary |
||
| Line 3: | Line 3: | ||
name = GetChildren | name = GetChildren | ||
|arguments = | |arguments = | ||
|returns = [[Table]] ''children'' | |returns = [[Tables|Table]] ''children'' | ||
|description = Returns a read-only table of this Object's children | |description = Returns a read-only table of this Object's children | ||
|object = Global | |object = Global | ||
Latest revision as of 21:24, 25 September 2021
| Function | |
|---|---|
| Syntax | GetChildren( ) |
| Returns | Table children |
| Description: | Returns a read-only table of this Object's children |
| In Object: | Global |
Example
(Simple example)
local children = workspace:GetChildren()
for c = 1, #children do
print(children[c].Name)
end
(More efficient example)
local children = workspace:GetChildren()
for i, item in pairs(children) do
--"item" is the object, "i" is the index of the table it is at
print("index: "..i)
print("Object: "..item)
end