lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Optional integer constant after "break" specifies number of enclosing
loops to break. `break 1` means the same as `break` without a number.

Example: find an item in a table of lists, with shortcut exit from a list.

for k,a in pairs(t) do
    for n,b in ipairs(a) do
       if futile(b) then break end
       if found(b) then row,col = k,n; break 2; end
   end
end