Support for iterator-style for loops, and "pairs" builting function

This commit is contained in:
James Roseborough
2007-06-10 22:53:09 +00:00
parent e1e6625aa1
commit de763e0a1e
8 changed files with 98 additions and 20 deletions

View File

@@ -1,17 +1,16 @@
i = 777
while i<780 do
i = 777
while i<780 do
print(i)
i = i+1
end
end
a,b = 0,1
while true do -- infinite loop
a,b = 0,1
while true do -- infinite loop
print( b )
a,b = b,a+b
if a>10 then break end -- exit the loop if the condition is true
end
end
for count = 336,330,-2 do print(count) end -- numerical iteration
-- for key,value in pairs({a=10, 3.14159265358, c="banana"}) do print(key, value) end
for count = 336,330,-2 do print(count) end -- numerical iteration
for key,value in pairs({a=10, 3.14159265358, c="banana" }) do print(key, value) end

Binary file not shown.