Fix factioncolor tag GetUnitBattlefieldFaction error (#97)

Fixed error: "attempt to call method 'GetUnitBattlefieldFaction' (a nil value)"
at Tags.lua:838

Changes:
- Changed E:GetUnitBattlefieldFaction(unit) to call the global API function directly
- Added nil check for GetUnitBattlefieldFaction in case it's not available
- Added fallback to UnitFactionGroup(unit) for compatibility

The issue was that the code was trying to call GetUnitBattlefieldFaction as a
method on the E object (E:GetUnitBattlefieldFaction), but this method doesn't
exist. The fix calls the WoW API function directly with a proper nil check and
fallback to ensure the tag works in all cases.

Fixes #TBD
This commit is contained in:
ips-ux
2026-01-19 12:46:12 -07:00
committed by GitHub
parent 0a792fb7f0
commit e11b8b0817
+1 -1
View File
@@ -835,7 +835,7 @@ do
}
E:AddTag('factioncolor', 'UNIT_NAME_UPDATE UNIT_FACTION', function(unit)
local englishFaction = E:GetUnitBattlefieldFaction(unit)
local englishFaction = (GetUnitBattlefieldFaction and GetUnitBattlefieldFaction(unit)) or UnitFactionGroup(unit)
return factionColors[englishFaction or '']
end)
end