From 56a5bb7594471b08af43ebda8c8df2ba9bc9037a Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Sat, 5 Sep 2026 19:02:00 +0200 Subject: [PATCH] Limit Metric Range scans to visible tooltip lines --- mods/metric-range.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/metric-range.lua b/mods/metric-range.lua index c68d35c..1860664 100644 --- a/mods/metric-range.lua +++ b/mods/metric-range.lua @@ -31,7 +31,15 @@ module.enable = function(self) local name = tooltip:GetName() if not name then return end - for i = 1, 30 do + -- GameTooltip-style frames expose NumLines() in Vanilla. Only inspect the + -- lines that actually exist instead of probing 30 left/right font strings + -- on every tooltip show. Keep the historical 30-line ceiling as fallback. + local lines = 30 + if tooltip.NumLines then + lines = math.min(tooltip:NumLines() or 0, 30) + end + + for i = 1, lines do local left = _G[name .. "TextLeft" .. i] if left then local old = left:GetText()