View Single Post
Old 09-18-2009   #453
Shefki
Senior Member
 
Join Date: Feb 2007
Posts: 464
Default Re: LuaTexts Official Thread

Quote:
Originally Posted by fanto View Post
Actually, that's what I'm afraid of.

As already said, before I updated PB to beta5 I installed LibRangeCheck excatly like I would do it with any other addon. There is also no other addon embedding the Lib. You can try the code with your current PB version and tell me if it's working the way you meant it to work.
I didn't write the code so I don't intend it to work or not work.

After looking at the code and thinking about it more it's never going to work reliably as written. The change to LoadOnDemand stuff probably shifted around the load order on your particular system. PitBull4 and LuaTexts is loading before LibRangeCheck.

Something like this should work. It won't throw errors if libRangeCheck isn't loaded and will try and load it if it isn't. It also avoids repeated calls to LibStub.

Code:
if not libRangeCheck then
     LoadAddOn("LibRangeCheck-2.0")
     libRangeCheck = LibStub("LibRangeCheck-2.0")
end
if libRangeCheck then
     local minRange, maxRange = libRangeCheck:getRange(unit)
     UpdateIn(1.0)
     return "|cff404040%s",  tostring(maxRange or "oor")                      
end
Shefki is offline   Reply With Quote