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

Can somebody explain to me what "In pairs", does and how to use it?

Asked by 10 years ago

Can somebody explain to me what "In pairs", does and how to use it?

1 answer

Log in to vote
2
Answered by
haillin 60
10 years ago

Okay well first you need to know whats "Pairs" is... Pairs iterates through tables.

for example

a={"This","is","an","Example"}

for k,v in pairs(a) do

print(v)    

end

-a is your table

-k is the key

-v is the value

-pairs(a) iterates through the table a

that is an example for using a generic for, it's very simple to get more detailed information on it I recommend thoroughly reading through the article on the Roblox Wiki.

The Link is: http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs

Ad

Answer this question