GetChildren (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy fixed |
>NXTBoy Obviously examples can't use meaningful variable names... |
||
Line 1: | Line 1: | ||
<onlyinclude>{{Method|name = GetChildren | <onlyinclude>{{Method | ||
|arguments = | |name = GetChildren | ||
|returns = [[Table]] ''children'' | |arguments = | ||
|description = Returns a read-only table of this Object's children. | |returns = [[Table]] ''children'' | ||
|object = | |description = Returns a read-only table of this Object's children. | ||
|object = Instance | |||
}}</onlyinclude> | }}</onlyinclude> | ||
{{clear floats}} | {{clear floats}} | ||
Line 18: | Line 19: | ||
{{Example|<pre> | {{Example|<pre> | ||
local children = game.Workspace:GetChildren() | local children = game.Workspace:GetChildren() | ||
for | for index, object in ipairs(children) do | ||
print("index: " | print("index: ",index) | ||
print("Object:",object) | |||
print("Object: " | |||
end | end | ||
</pre>}} | </pre>}} |
Revision as of 09:12, 26 October 2010
![]() | |
Returns | Table children |
Description: | Returns a read-only table of this Object's children. |
Member of: | Instance |
- For loop (Simple example)
Example
local children = game.Workspace:GetChildren() for c = 1, #children do print(children[c].Name) end
- Generic for (More efficient example)
Example
local children = game.Workspace:GetChildren() for index, object in ipairs(children) do print("index: ",index) print("Object:",object) end