Stuf perchp lua help
I found a post similar to what i need help with but it was a little older and wasn't 100% what i wanted. Mainly I'm looking to have the text for perchp be colored depending on what it's at. This is what I found code wise:
function(unit, cache, textframe)
if UnitExists(unit) then
local perchp = 100 * UnitHealth(unit)/UnitHealthMax(unit)
return "%.1f%%",perchp
else
local perchp = 100 * UnitHealth("player")/UnitHealthMax("player")
return "%.1f%%",perchp
end
end
Now i don't need the % sign or the decimals and i can remove that just fine but I'm not sure how to add the color to the text part. Any help would be greatly appreciated.
|