xxxxxxxxxx
local Example = {
"a",
"b",
"c",
"d"
}
-- Table
for k, v in pairs(Example) do
(function()
if v == "b" then
return
end
print(v)
end)()
end
-- This will print only a, c and d but not b.
xxxxxxxxxx
-- Lua has no continue statement because it's designed to
-- be lightweight. Use goto instead:
arr = {1, 2, 3, 5, 6, 7, 8}
for key, val in ipairs(arr) do
if val > 6 then
goto skip_to_next
end
-- perform some calculation
::skip_to_next::
end