local a = {} for i = 1, 20 do a[i] = {} for j = 1, 20 do a[i][j] = math.random(1, 20) end end for i = 1, 20 do for j = 1, 20 do io.write(string.format("%2d ", a[i][j])) if a[i][j] == 20 then print() break 2 -- break from outer loop end if j % 10 == 0 then print() end end end