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

Could someone explain to me all the contents of a generic for loop? [closed]

Asked by
Stadow 30
7 years ago

So I've been trying to learn Lua lately and all of it's made sense so far. I've gotten into some of the intermediate things but am still stuck on some of the basics that I can't find any information that makes sense for me on. So I understand the for loop like the one that goes like

for i = 1, 10 do

that for loop is simple and makes sense to me, the one I don't understand is

for _, i in ipairs do

I don't understand that one that well, like I understand some things like I know the i stands for iterator and stuff but sometimes it's v or k (v probably stands for value BUT K??) and also what the heck is the _,? ALSO what does it mean by pairs? Is that just something that's needed or what does it mean, and sometimes it's also ipairs... what's the difference? Thanks guys if you answer this, I just can't seem to find any information on this anywhere on wiki that I actually understand so I decided to come here.

Marked as Duplicate by Shawnyg

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?