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

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

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

1 answer

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

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