ElvUI Enhanced Again (DF)

ElvUI Enhanced Again (DF)

1M Downloads

LUA Error: UnitFactionGroup("unit" [,checkDisplayRace])

jwshive opened this issue · 19 comments

commented

New today. When I disable ElvUI_Enhanced BFA the error goes away.

Message: ...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:80: Usage: UnitFactionGroup("unit" [,checkDisplayRace])
Time: Tue Mar 12 18:03:30 2019
Count: 1
Stack: ...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:80: Usage: UnitFactionGroup("unit" [,checkDisplayRace])
[C]: ?
[C]: in function UnitFactionGroup' ...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:80: in function InspectPVPFrame_Update'
...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:60: in function <...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:58>

Locals:

Seemed like a default blizzard ui error, but disabling the addon silences the error.

commented

I've been looking into this, but I haven't found the problem yet. I don't use the function "UnitFactionGroup" so it still might be a bug in wow itself. Maybe it gets called internally by another function.

I'll keep digging.

commented

I was having the issue too, but after one of the hotfixes was applied last night the issue disappeared. Blizz may have just found the problem with their own code and fixed it.

I've been looking into this, but I haven't found the problem yet. I don't use the function "UnitFactionGroup" so it still might be a bug in wow itself. Maybe it gets called internally by another function.

I'll keep digging.

By the way, you use the function in the Farmer.lua module, though it's in the right syntax.
It is used by many addons though, so don't believe the issue was exclusive to ElvUI Enhanced.

commented

I can confirm that the message is gone today as well.

commented

I can confirm that I am still having this issue. I have uninstalled and reinstalled all Elvui parts and this addon is the only one causing the error.

commented

Yeah, I spoke too soon. It didn't pop up on log in but it did the next time my ui reloaded.

Date: 2019-03-13 18:22:48
ID: 1
Error occured in: Global
Count: 1
Message: ...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua line 80:
Usage: UnitFactionGroup("unit" [,checkDisplayRace])
Debug:
[C]: UnitFactionGroup()
...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:80: InspectPVPFrame_Update()
...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:60:
...erface\AddOns\Blizzard_InspectUI\InspectPVPFrame.lua:58
Locals:
(*temporary) = nil

AddOns:
Swatter, v8.1.6241 (SwimmingSeadragon)
AddOnSkins, v4.10
AdiBags, vv1.9.14
AdiBagsAzeriteGear, v0.2
AdiBagsHearthstones, v7.3-release1
AngryAssignments, vv1.11.6
AskMrRobot, v74
BigWigs, vv140
BonusRollPreview, v80100.47-Release
Details, v
DetailsChartViewer, v
DetailsDeathGraphs, v
DetailsEncounterDetails, v
DetailsRaidCheck, v
DetailsRaidPowerBars, v
DetailsStreamer, v
DetailsTargetCaller, v
DetailsTimeLine, v
DetailsTinyThreat, v
DetailsVanguard, v
ElvUI, v11.02
ElvUICustomTweaks, v1.45
ElvUIEnhanced, v3.3.6-beta1
ExRT, v4000
MasterPlanA, vA
MethodDungeonTools, v2.4.1
Pawn, v2.2.39
PersonalLootHelper, v2.19
Simulationcraft, v1.10.11
SlideBar, v8.1.6239 (SwimmingSeadragon)
Stubby, v8.1.6240 (SwimmingSeadragon)
WeakAuras, v2.11.6
WorldQuestTracker, v
ZygorGuidesViewer, v7.0
BlizRuntimeLib_enUS v8.1.5.80100
(ck=380)

commented

Im having the same error:

2x Blizzard_InspectUI\InspectPVPFrame.lua:80: Usage: UnitFactionGroup("unit" [,checkDisplayRace])
[C]: in function `UnitFactionGroup'
Blizzard_InspectUI\InspectPVPFrame.lua:80: in function `InspectPVPFrame_Update'
Blizzard_InspectUI\InspectPVPFrame.lua:60: in function <Blizzard_InspectUI\InspectPVPFrame.lua:58>

Locals:
(*temporary) = nil

Also the function UnitFactionGroup is used in modules/farmer/farmer.lua - line 411
local playerFaction = UnitFactionGroup('player')

commented

Same here. Error seems to be triggered by hovering the mouse over other players.

commented

I narrowed down to modules/misc/paperdoll.lua. Removing it from modules/misc/load_misc.xml makes
the errors stop.

commented

Yeah, I spoke too soon. It didn't pop up on log in but it did the next time my ui reloaded.

Also spoke too soon. I can go awhile without it popping up, but once it starts happening it seems to keep retrying the function until I reload the game.

Seems the farmer module was meant to be disabled around version 3.2.0-beta1, according to the Changelog. When I get home tonight I'm going to try commenting out the load_farmer.xml file.

Edit:
What puzzles me is the farmer xml & lua isn't even being called by the TOC file or the load_modules.xml. I'm still not convinced this problem is specific to ElvUI_Enhanced. This thread has even cropped up on the forums: https://us.forums.blizzard.com/en/wow/t/lua-error-blizzard-inspectui/123441

commented

I can reproduce this pretty reliably by mousing over a friendly player and pushing SHIFT. It won't happen again right away for the same player (caching?), but it will after some time passes.

It does not happen w/o pushing SHIFT.

commented

So I put return statements on the first line of every function in paperdoll.lua, and then started removing them from the bottom up. The line that causes the error is LoadAddOn("Blizzard_InspectUI").

The error happens even if every function except PD:Initialize (which merely registers events) and the lines up to and including the LoadAddOn call are disabled (i.e. it is really the loading of Blizzard_InspectUI, and not anything done before or afterward, that causes the error).

I modified the code by putting in an event handler for ADDON_LOADED and doing the access to the InspectUI frames there when Blizzard_InspectUI loads. It only loads if I manually inspect someone, but the errors don't seem to happen doing it that way.

I couldn't find a way to load it programmatically without seeing the error though.

commented

I think I finally got it...

paperdoll.lua.txt

commented

I've been told by guild members that it has to with anything that looks at Azurite. Not sure if that will be helpful.

commented

Thanks for all the help guys. I'll try to fix and push an update this weekend.

commented

Can confirm @belechannas 's fix works.

commented

Pushed a new version with the fix.

commented

So far the fix works. Thank you very much. :)

commented

FWIW, I don't use ElvUI and I also have this error. I don't use any major overhaul addons.

I followed the flow of the error. It's attempting to do a numerical comparison of level < SHOW_PVP_TALENT_LEVEL. level is a local created by UnitLevel(INSPECTED_UNIT). Both SHOW_PVP_TALENT_LEVEL and INSPECTED_UNIT are blizzard global variables. UnitLevel and UnitFactionGroup will complain if you pass it an invalid unit ID (such as if the unit passed to it is nil). INSPECTED_UNIT happens to be nil until you inspect someone.

The whole thing gets set off when InspectPVPFrame_Update() is run, either from INSPECT_HONOR_UPDATE event firing or InspectPVPFrame is shown. If INSPECTED_UNIT is still invalid or nil, then it will throw an error. But if you happen to toss in a valid unit ID into INSPECTED_UNIT before any of this happens (such as "player") then the error doesn't ever happen.

It just seems to be bad blizzard coding.

commented

It just seems to be bad blizzard coding.

Well, I think the point, at least as regards this bug, is that you shouldn't manually load the inspection UI before something is being inspected. That is basically consistent with your analysis. What this addon was doing was trying to modify the graphical appearance of the inspection UI (putting item levels on every button) before there was anything to inspect.

In the process of debugging, I checked all my other addons (I use quite a few) and none of them were doing the thing which ElvUI_Enhanced was doing which caused the error. So it may have been a misunderstanding or misuse of the API in this case.

The right/safe way to do it is to wait until something is inspected, and the game itself loads the Inspection UI, detect that happening, and only then modify it.