diff --git a/AddOns/!!!ClassicAPI/Util/ColorUtil.lua b/AddOns/!!!ClassicAPI/Util/ColorUtil.lua index 11c1dd12..d6e13434 100644 --- a/AddOns/!!!ClassicAPI/Util/ColorUtil.lua +++ b/AddOns/!!!ClassicAPI/Util/ColorUtil.lua @@ -7,6 +7,16 @@ do end end +-- Built here (not in Constants.lua) because it references the +-- PLAYER_FACTION_COLOR_* objects, which Color.lua materializes from +-- C_UIColor — and ColorUtil.lua loads after Color.lua, so they exist by +-- now. (Constants.lua loads earlier, where they were still nil.) +PLAYER_FACTION_COLORS = +{ + [0] = PLAYER_FACTION_COLOR_HORDE, + [1] = PLAYER_FACTION_COLOR_ALLIANCE, +}; + function ExtractColorValueFromHex(str, index) return tonumber(string.sub(str, index, index + 1), 16) / 255; end diff --git a/AddOns/!!!ClassicAPI/Util/Constants.lua b/AddOns/!!!ClassicAPI/Util/Constants.lua index 8b0a1383..bcc6ff4a 100644 --- a/AddOns/!!!ClassicAPI/Util/Constants.lua +++ b/AddOns/!!!ClassicAPI/Util/Constants.lua @@ -118,11 +118,10 @@ FACTION_LABELS_FROM_STRING = { ["Alliance"] = FACTION_ALLIANCE, } -PLAYER_FACTION_COLORS = -{ - [0] = PLAYER_FACTION_COLOR_HORDE, - [1] = PLAYER_FACTION_COLOR_ALLIANCE, -}; +-- PLAYER_FACTION_COLORS is built in Util/ColorUtil.lua, not here: it +-- references the PLAYER_FACTION_COLOR_* color objects, which Color.lua +-- only materializes (from C_UIColor) at a later load step. Defining it +-- here captured nils and produced an empty table. WOW_PROJECT_MAINLINE = 1; WOW_PROJECT_CLASSIC = 2;