Lua dla pętli
-- 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 in/for loops
for key, value in pairs(table) do
-- If value is a table then you can do another iteration tho, for in for in isn't recommended.
end
for key, value in next, table do
-- Same as above.
end
for variable = 0, 1, 1 do
-- The variable is automatically set to the first value you input after "=".
-- The variable is then incremented by the third value you input after "="
-- until it reaches the second value you input after "=".
variable = variable + 1 -- The above only works if you increment it,
-- else it infinitely loops through the block.
end
while true do
-- Infinite loop
end