function find(array, element) local index = 0 for i = 1, #array do if array[i] == element then index = i break end end return index end function showBoard(board) for row = 1, 9 do print(table.concat(board[row], " ")) end end function cloneBoard(b) local c = {} for i = 1, 9 do c[i] = {} for j = 1, 9 do c[i][j] = b[i][j] end end return c end function loadBoard(fn) local problem = {} local solution = {} local board = problem local r = 0 for line in io.lines(fn) do if line:gsub("%s+", "") == "" then board = solution r = 0 else r = r + 1 local c = 0 board[r] = {} for item in line:gmatch("%w+") do c = c + 1 board[r][c] = tonumber(item) end end end return problem, solution end