get("#451") -- getIcons (grid size=3) get("#388") -- rect functions fw, fh = 7, 15 -- font size function findLeftBorder() for x = 0, w-1 do local nwhite = 0 for y = 0, fh*2-1 do if img.getInt(x, y) == 0xFFFFFF then nwhite = nwhite+1 end end if nwhite >= fh-1 then -- one row might not be white leftBorder = x return end print("x", x, "nwhite", nwhite) end error("left border not found") end w, h = img.width, img.height function findGrid() findLeftBorder() getIcons() r = icons["00f8a328"] or icons["00919df2"] or icons["002afe9a"] -- the latter is in black if r == nil then error "package statement not found" end r = stringtorect(r) --return r.x..", "..r.y sx, sy = r.x, r.y-2 sx, sy = (sx-leftBorder) % fw + leftBorder, sy%fh end