of     1   

bananaslayer3000
#228169335Tuesday, November 28, 2017 12:46 AM GMT

I still don’t get it. What does pairs, i pairs mean? What would you use For I,v in pairs() do. I read the wiki, I still don’t get it. Like where would you use it? Can anyone help? Thank you
Wrathoxic
#228169394Tuesday, November 28, 2017 12:47 AM GMT

JarodOfOrbiter
#228169620Tuesday, November 28, 2017 12:52 AM GMT

It iterates over a table. i is the position of the element, and v is the element itself. They don't need to actually be named i and v. Inside of the parentheses next to pairs, put the table. When you're new to scripting, this will usually be some form of GetChildren, because applied coding is a good way to learn. If you ever see 'ipairs', it's basically the same as 'pairs', but with a few more limitations that would take me extra time to explain. In theory, it is supposed to be able to run faster because it is doing less, but in practice it tends to run only as fast as 'pairs', and occasionally slower. This is a glitch, it's not supposed to actually be so slow. Having said that, I hope it will be no surprise when I say you needn't concern yourself with the difference between the two, just use 'pairs' and you'll be all good.
LaeMVP
#228169647Tuesday, November 28, 2017 12:53 AM GMT

yeah ipairs goes in order and stops if tbl[i] == nil pairs is next but in parenthetical form next iterates table and skips nil
bananaslayer3000
#228169882Tuesday, November 28, 2017 12:57 AM GMT

What would you use pairs for then? I see it in a lot of class choosing for god game scripts.
LaeMVP
#228170027Tuesday, November 28, 2017 12:59 AM GMT

iteration
bananaslayer3000
#228170080Tuesday, November 28, 2017 1:00 AM GMT

not god FPS
iiNemo
#228170186Tuesday, November 28, 2017 1:01 AM GMT

ipairs skips over nil like local Table = {'Hi', nil, 'Hey} for _, v in ipairs (Table) do print(v) end Output: Hi Hey Fish Are Friends, Not Food
LaeMVP
#228170343Tuesday, November 28, 2017 1:03 AM GMT

no ipairs stops at nil, next skips nil did you not read wat i said nemoo :(

    of     1