get("#137") -- split get("#339") -- signature maker result = otherresults["#336"] or error("Need result of #336") _, _, s = string.find(result, ": (.+)") if s == nil then return end parts = split(s, ", ") local orig = img tbl = {} for _, segment in ipairs(parts) do x1, x2 = unpack(split(segment, "-")) y1, y2 = 0, orig.height -- crop the image img = { width = x2-x1, height = y2-y1, getInt = function(x, y) return orig.getInt(x+x1, y+y1) end } -- get segment signature w, h = img.width, img.height hor, vert = getSegmentSignature(true), getSegmentSignature(false) if hor ~= nil and vert ~= nil then table.insert(tbl, hor.."-"..vert) end end return table.concat(tbl, " ")