User:OrenBochman/Lua Loops
Appearance
Loops
[edit]Do Block
[edit]do
...
end
Do While Loop
[edit]while cond do
...
end
Repeat Loop
[edit]repeat
...
until cond
For Loop - Numeric
[edit]- variable i is local to the loop block
for i = start, stop do
...
end
For Loop - Generic
[edit]- uses a keyword - in
- variable i is local to the loop block
for i in iterator do
...
end
- iterator is a function returning a list of remaining values. Standard iteritors are
- Pairs
- iPairs