Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What do the letters and pair mean in scripting?

I’m new to coding, but the one thing I see almost everywhere on YouTube and here is two letters and pair following. Are these letters the same as variables or are they something much cooler than that? For example:

Local object = game.workspace.part

Is it the same as saying

Local k = game.workspace.part
Local v = game.workspace.part

And what does the in pair function do? Thanks for the help :)

1 answer

✓ Accepted answer

I suppose you're speaking of

for i, v in pairs(script.Parent:GetChildren()) do

end

It is a loop where the i variable is the index, and the v is the object it is referring to. In the loop above, it will go through all children inside an object where V is the child and i is the index.

Heres a full explanation https://www.lua.org/pil/7.3.html

This discussion is preserved as it was. New answers, comments, and votes are closed.