GetChildren (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
Fixed another spacing issue
>Camoy
Redirecting to GetChildren (Method)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{|
#REDIRECT [[GetChildren_(Method)]]
|<onlyinclude>
{{Function|
name                  = GetChildren
|arguments            =
|returns              = [[Table]] ''children''
|description          = Returns a read-only table of this Object's children
|object              = Global
|}}
</onlyinclude>
|}
 
==Example==
(Simple example)
<pre>
 
local children = game.Workspace:GetChildren()
for c = 1, #children do
    print(children[c].Name)
end
 
</pre>
(More efficient example)
<pre>
local children = game.Workspace:GetChildren()
for i, j in ipairs(children) do
    print("index: ")  --j is the object, i is the index of the table it is at
    print(i)
    print("Object: ")
    print(j)
end
</pre>

Latest revision as of 12:31, 18 January 2011