IsA (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mr Doom Bringer
No edit summary
>Mr Doom Bringer
No edit summary
Line 1: Line 1:
<onlyinclude>
{|
|<onlyinclude>
{{Function|
{{Function|
name                  = IsA
name                  = IsA
Line 6: Line 7:
|description          = Returns true if instance is that class or a subclass
|description          = Returns true if instance is that class or a subclass
|object              = Global
|object              = Global
|}}
|}}</onlyinclude>
</onlyinclude>
|}
 
 
IsA is useful for figuring out if an object is a specific type of object. For example, if you do Part:IsA("Part") it will return "true".
 
{{Example|This can be used to find a part in a list of objects.
 
<pre>
children = script.Parent:GetChildren()
 
for i=1, #children do
    if children[i]:IsA("Part") then
        print(children[i].Name .. " is a Part object.")
    end
end
</pre>
}}

Revision as of 21:30, 13 July 2010

IsA( String classname )
Returns Boolean
Description: Returns true if instance is that class or a subclass


IsA is useful for figuring out if an object is a specific type of object. For example, if you do Part:IsA("Part") it will return "true".

Example
This can be used to find a part in a list of objects.
children = script.Parent:GetChildren()

for i=1, #children do
    if children[i]:IsA("Part") then
        print(children[i].Name .. " is a Part object.")
    end
end