GetChildren (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy added |
>Camoy fixed |
||
Line 1: | Line 1: | ||
<onlyinclude>{{Method|name = GetChildren | |||
|arguments = | |arguments = | ||
|returns = [[Table]] ''children'' | |returns = [[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 = [[Instance]] | |object = [[Instance]] | ||
}}</onlyinclude> | |||
{{clear floats}} | |||
*[[Loops#The_for_loop|For loop]] (Simple example) | *[[Loops#The_for_loop|For loop]] (Simple example) | ||
{{Example|<pre> | {{Example|<pre> |
Revision as of 15:51, 30 August 2010
![]() | |
Returns | Table children |
Description: | Returns a read-only table of this Object's children. |
Member of: | [[RBX.lua.Instance (Object)|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 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