Maze solver (download/code):
https://pastebin.com/AfAaVR3P

Usage:
Spoiler

start_x = 1
start_y = 2
exit_x = 1
exit_y = 4
maze = {
  {0, 0, 1, 0},
  {0, 1, 1, 0},
  {0, 0, 1, 0},
  {1, 0, 0, 0}
}
wall_number = 1
space_number = 1
------------------------------ Not necessary!
config = {
doYield = 5000, -- Speed | default: 500
retSingleExit = true, -- Return 1 or all exits | defualt: true
minDepth = 128 -- Big maze > Small maze | defualt: 65535
-- [bigMap = false -- More speed for bigger maps | default: true] !!! - disabled
}
hide_errors = false -- Show or hide FAST ERRORS! (like spawn is a wall)
------------------------------
-- [[
Space and walls can be tables
wall_number = { 1, 2, 3 }
space_number = {1, 2, 3}
]]
way = findWay(start_x, start_y, exit_x, exit_y, maze, wall_number, space_number, config, hide_errors)
--[[
the variable way is returned as
1: { x, y }
2: { x, y }
...
way[1][1] = 1:x
way[1][2] = 1:y
way[2][1] = 2:x
way[2][2] = 2:y
]]
--[[
If you want to use images as mazes than you have to use the function
turnImage(image) first.
maze = turnImage(paintutils.loadImage(file))
wall_number = colors.white
space_number = colors.black
]]

Example:

shell.run("maze_solver")
term.clear()
local image = paintutils.loadImage("image_file")
trnimage = turnImage(image)
paintutils.drawImage(image, 1, 1)
paintutils.drawPixel(2, 2, colors.orange)
paintutils.drawPixel(49, 18, colors.green)
local way = findWay(2, 2, 49, 18, trnimage, colors.white, colors.black)
for i, v in pairs(way) do
   paintutils.drawPixel(v[1], v[2], colors.red)
end
os.pullEvent("char")

Image:
Spoiler

Changelog:
Spoiler- Disabled optimization for bigger maps cause of wrong movment.