MatchResult:getScore()
Returns the confidence score of the match.
Description
The getScore() method returns a decimal value representing how closely the found region matches the search template. A higher score indicates a better match.
- For image matching, the score typically ranges from
0.0to1.0, where1.0represents a perfect match. - The default match threshold is usually around
0.8(80% confidence).
This is useful for filtering results based on match quality or for debugging purposes.
Signature
getScore(): number
Returns
number - The confidence score of the match (typically between 0.0 and 1.0).
Example
local result = Screen:find("template.png")
if result then
local score = result:getScore()
toast("Match confidence: " .. (score * 100) .. "%")
-- Only proceed if confidence is high enough
if score >= 0.9 then
toast("High confidence match found!")
end
end