for loop lua code example
Example 1: lua for loop
for k,v in pairs(tbl) do
print(k)
print(v)
end
for i=0, num do
print(i)
end
Example 2: infinite loop lua
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
while true do
print("Hello World")
wait(1)
end
Example 3: For loop lua
for startValue, EndValue, [increments] do
end
Example 4: for loop lua
local t = {}
for index, value in ipairs(t) do
print(index, value)
end
Example 5: for loop lua
for x = 0, 10, 1 do
print(x)
end
Example 6: for loop lua
local t = {}
for key, value in pairs(t) do
print(key, value)
end