VUHDO_customizeHotIcons repeatedly raises "bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))"
VuhDo version
3.145-wotlkc
World of Warcraft region
Americas
World of Warcraft client language
enUS
Summary of the issue:
I noticed the Power Word: Shield, Weakened Soul indicators were not working (no state change). BugSack shows an enormous number of errors, I presume this code is invoked via a frame update handler.
Error Stack
19757x bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a])) [string "=[C]"]: in function `SetVertexColor' [string "@VuhDo/VuhDoBarCustomizerHots.lua"]:342: in function <VuhDo/VuhDoBarCustomizerHots.lua:198> [string "@VuhDo/VuhDoBarCustomizerHots.lua"]:392: in function <VuhDo/VuhDoBarCustomizerHots.lua:368> [string "@VuhDo/VuhDoBarCustomizerHots.lua"]:640: in function <VuhDo/VuhDoBarCustomizerHots.lua:509> [string "@VuhDo/VuhDoBarCustomizerHots.lua"]:730: in function <VuhDo/VuhDoBarCustomizerHots.lua:725> [string "@VuhDo/VuhDoEventHandler.lua"]:1391: in function <VuhDo/VuhDoEventHandler.lua:1303> Locals: (*temporary) = "bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))"
The Offending Code
Line 342:
tIcon:SetVertexColor(tHotColor["R"], tHotColor["G"], tHotColor["B"], tIsChargeAlpha and tHotColor["O"]);
The expression tIsChargeAlpha and tHotColor["O"]
is the problem. If tIsChargeAlpha
is true then the expression resolves to tHotColor["O"]
. If tIsChargeAlpha
is false, then the expressions resolves to false, and the error is raised.
The alpha value should be in [0,1] or nil.
This solves the immediate problem by forcing the expression to always resolve to tHotColor["O"]
or 0:
tIcon:SetVertexColor(tHotColor["R"], tHotColor["G"], tHotColor["B"], (tIsChargeAlpha and 1 or 0) and tHotColor["O"]);
However I don't know the intent of tIsChargeAlpha
, e.g. should alpha be nil if tIsChargeAlpha
is false? Thus whether this is a legitimate fix is unknown.