for i,v in pairs() do
I have looked around for tutorials on for loops and I checked the wiki but it I don't really understand how it works. If you could link me a video then that would be great!
Most people use this type of loop to look inside of a table, i, will be the amount of items in the table and v will be the items it self example:
table = {apple, orange, peach}
for i, v in pairs (table) do
print(i)-- will print 1, 2, 3 print(v)-- will print apple , orange, peach
end
you can watch peaspod youtube video on this topic. I just started learning and thats a great place to start
For loops just really tells the script to meet a certain requirement to do something. They are split into three types of loops: For, while, and repeat. One being like you said~~~~~~~~~~~~~~~~~ for I,v in pairs() do
. The other can be
local i = 1 while i < 10 do or local i = 1 repeat print(i,"< 10") i = i + 1 until i==10 print (i, "=10").
~~~~~~~~~~~~~~~~~
That is really all it is to it.
https://www.youtube.com/watch?v=ApggytDNfs8
That would be a good video to see.