Iteration Lua
INFO
TLDR To just iterate over a table of elements:
lua
local fruits = { "apple", "banana", "pear" }
for index, fruit in ipairs(fruits) do
print(index, fruit)
end
Iteration in Lua is done by Iterators and Closures.
Common builtin iterators (like pairs & ipairs) are Stateless