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

What is Pairs?

Asked by 10 years ago

I read other forum posts and wiki,still don't understand what is Pairs. Can someone explain it more easier to understood?

2 answers

Log in to vote
3
Answered by 10 years ago

the 2 buddys. i and v are friends. pairs bosses them around. i and v do not like pairs, they stick together. v is the most useful, and i is mostly left out. pairs bosses around v. heres an example of him telling him to get the players:

for i,v in pairs(game.Players:GetPlayers()) do

end

now that v has been ordered to do something by pairs, you can use v to do multiple things. in this case, you can kick the players.

v:Kick()
0
"i,v" means i to v or i and v? ssd21345 5 — 10y
0
its including both i and v in the cycle. joemom33 10 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

pairs is an iterator function that will return a new index and its value from a table every time it is called. See the wiki and Lua reference manual

Answer this question