From 37cd061474cce3f35d9841e5e6d4f3f03b8bafb9 Mon Sep 17 00:00:00 2001 From: cybeloras Date: Fri, 2 Aug 2013 04:02:54 +0000 Subject: [PATCH] - Added a call to DogTag.checkYield to help solve the "script ran too long" errors --- LibDogTag-Unit-3.0.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/LibDogTag-Unit-3.0.lua b/LibDogTag-Unit-3.0.lua index 5d3cbe7..cb01280 100644 --- a/LibDogTag-Unit-3.0.lua +++ b/LibDogTag-Unit-3.0.lua @@ -506,6 +506,13 @@ end) local lastPlayerPower = 0 local lastPetPower = 0 +local checkYield = DogTag.checkYield +if not checkYield then + -- If LibDogTag doesn't include checkYield (old version) + -- Then just make checkYield an empty function to prevent errors. + checkYield = function() end +end + local nextRefreshGUIDsTime = 0 DogTag:AddTimerHandler("Unit", function(num, currentTime) if nextRefreshGUIDsTime > currentTime then @@ -530,6 +537,10 @@ DogTag:AddTimerHandler("Unit", function(num, currentTime) local newGUID = unitToGUID[unit] if oldGUID ~= newGUID then DogTag:FireEvent("UnitChanged", unit) + + -- This loop is where things get hung up all the time, + -- so we should check for a yield right here. + checkYield() end end nextUpdateWackyUnitsTime = currentTime + 0.5