WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Debugging possibilities? (https://www.wowinterface.com/forums/showthread.php?t=59598)

mataal 05-30-23 01:43 AM

Debugging possibilities?
 
1 Attachment(s)
Hey all, I'm getting error in BugSack (attached) but the addon I'm making doesn't do anything related with Unit or Player frames, kinda lost on how to debug this, are there any others ways of debugging in WoW?

Xrystal 05-30-23 05:11 AM

Are there any other addons you have that might ?

Depending on how many addons you have active you could either load them one at a time to see if the error triggers to identify which addons might be the cause or you could do it in blocks until you narrow it down to a few and then repeat using the one at a time pattern.

Then its the case of testing that potential faulty addon to see if it repeatedly makes the addon happen when it is the only addon loaded, but not with no addons loaded. You can then pass the information on to the developer of the addon for them to look into.

However, unless an addon has literally recreated a PlayerName object it shouldn't have broken Blizzards one.
Lua Code:
  1. function PlayerFrame_UpdatePlayerNameTextAnchor()
  2.     if PlayerFrame.unit == "vehicle" then
  3.         PlayerName:SetPoint("TOPLEFT", 96, -27);
  4.     else
  5.         PlayerName:SetPoint("TOPLEFT", 88, -27);  <<<<< Error Reported on this line on Retail 10.1
  6.     end
  7. end

mataal 05-30-23 07:10 AM

Sort it out.

So, basically in the beginning of my addon I had:

PlayerName = UnitName("PLAYER"):lower()

Renamed the variable name and error stopped, so I guess that PlayerName is a Blizzard global variable or something :)

PS: Thanks for the reply

Vampyr78 05-30-23 07:19 AM

There are 2 ways to avoid this kind of problems in the future.
  1. Use a prefix containing either your addon's name or an abbriviation of addon's name for every variable and function you create.
  2. Create an object with your addon's name that and declare all the variables and functions as members of that object.

Both appraoaches allow you to minimize risk given variable exists somewhere else.

mataal 05-30-23 07:54 AM

Quote:

Originally Posted by Vampyr78 (Post 342503)
There are 2 ways to avoid this kind of problems in the future.
  1. Use a prefix containing either your addon's name or an abbriviation of addon's name for every variable and function you create.
  2. Create an object with your addon's name that and declare all the variables and functions as members of that object.

Both appraoaches allow you to minimize risk given variable exists somewhere else.

Yeah, I've added a prefix and worked :)

Xrystal 05-30-23 07:55 AM

To follow on from Vampyr's comment.

If you place something like ..

local addonName, addonData = ...

at the top of each lua file you will have access to data you assign to the data table in all the files you have that in. Handy if you want your files separate but able to access the same set of data.


All times are GMT -6. The time now is 12:12 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI