Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I need help with lua Vocab. (what? and why?)

Asked by 9 years ago

Okay, these are some of the words I need help with. (that are not mentioned in scripting glossary)

isA

for __ (mainly the '_' part)

ipairs

inpairs

...

ModuleScript


that's all I have on the top of my head at the moment =)

1
If you search for these individually, you'll find answers to most/all of them already on the site. BlueTaslem 18071 — 9y
2
isA has not been asked yet kilerAK24 40 — 9y
2
why am I being devoted? I thought it was a pretty good question? Just because I don't know something doesn't mean I deserve to be devoted kilerAK24 40 — 9y
1
Here I helped you out with your rep since it was uncalled for, for being devoted and you did ask a good question this site doesn't supply much detail on such topics.. Prioxis 673 — 9y

1 answer

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

:IsA is a method of all instances (ROBLOX objects -- parts, scripts, models, services, etc).

It returns true if the object is the type of thing you ask for.

Usually, that will just be checking its ClassName (e.g., a Part has a "Part" .ClassName property).

Here's a simple example that checks if something can be assigned a random brick color using :IsA:

for _, object in pairs(workspace:GetChildren()) do
    if object:IsA("BasePart") then
        -- object will have a BrickColor, since it's a part-like-object
        object.BrickColor = BrickColor.random()
    end
end

ROBLOX organizes the types of objects into a hierarchy -- for instance, WedgeParts, Parts, SpawnLocations, etc, are all BaseParts. You can use :IsA("BasePart") to detect any type of part (where as :IsA("Part") or .ClassName == "Part" detect only Part objects themselves)

1
so IsA just basically checks if the class name is BasePart and then executes the code Prioxis 673 — 9y
1
It doesn't ONLY work with "BasePart" as the argument. You can use IsA to check any type of Instance, for example IsA("Script") or IsA("ScreenGui"). IsA isn't too hard to understand, for it directly translates to English. Perci1 4988 — 9y
Ad

Answer this question