For Loops have two essential things: index and value
Index is the numerical order in which the index is in the loop. So if the For Loop relooped 2 times, the index is 2. This can vary however [see example]
Value is used in tables, they give out what value is in the table in which order the Index is. So if I have a table with 3 Items stored in it and the Index is 3, this loop will be giving me the value inside the 3rd position of the array.
Here are the variants of a for loop:
for i = 1, 10 do
or
for i = 1, 10, 1 do
In this variation the for loop will loop 10 times until it will no longer loop. The first number is the StartValue, in which the index starts with that number. The Second Number is the EndValue, meaning if the Index reached that number, the loop will instantly break. And the 3rd number is optional if your increment is 1, but the 3rd Value is the IncrementValue in which how many times the Index is going to increase in which loop. Say if the number is 2 then the Index would go out like this: 1 → 3 → 5 → 7…
for Index, Value in pairs(table) do
Here is where Values are a thing. The Index will always increase by 1, going over the full table. In each loop it is going to look what value is in that index. Lets use an example table:
myTable = {"Hello", "GoodBye"}
If the Index is 1 then the value is Hello, since this is the position of the value in the table. If the Index is 2 then the Value is GoodBye, because of the same thing. The loop stops if there is no more value inside the table