Lua pour Loop
-- For K,V in table
for k,v in pairs(tbl) do
print(k)
print(v)
end
-- For i=0, num
for i=0, num do
print(i)
end
Orion
-- For K,V in table
for k,v in pairs(tbl) do
print(k)
print(v)
end
-- For i=0, num
for i=0, num do
print(i)
end
for <init>,<max/min value>, <increment> [default is 1]
do
statements
end
-- Example
for i=1, 5, 1
do
print(i)
end
--Output
1
2
3
4
5
-- Looping through strings require gmatch.
for str in targetStr:gmatch("([^%s]+)") do
print(str)
end
-- To learn about patterns please go to www.lua.org