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:
+1
-1
@@ -835,7 +835,7 @@ do
|
|||||||
}
|
}
|
||||||
|
|
||||||
E:AddTag('factioncolor', 'UNIT_NAME_UPDATE UNIT_FACTION', function(unit)
|
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 '']
|
return factionColors[englishFaction or '']
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user