ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   XML errors might appear after an addon has been disabeled (https://www.esoui.com/forums/showthread.php?t=1634)

zgrssd 05/26/14 01:04 PM

XML errors might appear after an addon has been disabeled
 
While testing on the EU client just about now, I noticed an odd bug - if a lua error would result in the XML running into a nil argument exception, that exception message will appear in the reload after the Addon has already been disabeled.

Wrote a more detailed bug report over in the ESO Forums, with code to reproduce and all:
http://forums.elderscrollsonline.com...n-is-disabeled

Xrystal 05/26/14 02:28 PM

I have noticed this as well. I thought it was just something I was doing wrong when no one else mentioned anything about it. Maybe it is to do with how their reloadui works.

lyravega 05/27/14 12:10 PM

I'd be careful. I was messing around and created a ghost chat window, which kept giving me errors all over the place till I learned about the destroyContainer() function :P

stjobe 05/27/14 01:38 PM

On a possibly related note: If you have errors in your lua code, the game may throw errors even if that code never runs.

I had a faulty lua statement in SorcererHelper that threw errors on loading a non-sorcerer character, even though this code is the first that runs for the addon:

Lua Code:
  1. local function OnAddOnLoaded(eventCode, addOnName)
  2.     if (addOnName == "SorcererHelper") then
  3.         if GetUnitClassId("player") ~= 2 then
  4.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_ADD_ON_LOADED)
  5.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_PLAYER_ACTIVATED)
  6.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_ACTION_SLOT_ABILITY_SLOTTED)
  7.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_ACTIVE_WEAPON_PAIR_CHANGED)
  8.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_UNIT_ATTRIBUTE_VISUAL_ADDED)
  9.             EVENT_MANAGER:UnregisterForEvent("SorcererHelper", EVENT_UNIT_ATTRIBUTE_VISUAL_REMOVED)
  10.             do return end
  11.         else
  12.             SH.SV = ZO_SavedVars:NewAccountWide("SorcererHelper_SavedVariables", 1, nil, SH.Defaults)
  13.             SH.CreateSettings()
  14.         end
  15.     end
  16. end
That "if GetUnitClassId("player") ~= 2" means that unless your character is a sorcerer, the addon will unregister all events and stop.

Even so, a bug in a function in code that never ran threw an "attempt to index a nil value" error. It stumped me for a while until I realized that it's a compile-time error.

I'm guessing the game loads and compiles all code during loading/reloading, and the bug I had gave a compile-time error - which was why it showed up even though the code itself never got called.

Seerah 05/27/14 01:40 PM

I haven't checked, but is GetUnitClassId() not available to call in the main chunk of your addon?

Xrystal 05/27/14 01:59 PM

I would suspect anything Player related would not be accessible until the player is first activated.

stjobe 05/27/14 02:23 PM

Quote:

Originally Posted by Seerah (Post 8618)
I haven't checked, but is GetUnitClassId() not available to call in the main chunk of your addon?

Quote:

Originally Posted by Xrystal (Post 8623)
I would suspect anything Player related would not be accessible until the player is first activated.

GetUnitClassId("player") can be called before EVENT_PLAYER_ACTIVATED, it works just fine. The function above runs on EVENT_ADD_ON_LOADED, but I also have several other initialization methods that run on EVENT_PLAYER_ACTIVATED.

I was merely suggesting that since the Lua code is compiled (and can therefore throw compile-time errors), perhaps something similar happens with the XML files for an addon - even if it is disabled.


All times are GMT -6. The time now is 04:46 AM.

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