Quantcast WoWInterface - View Single Post - need help with some LUA-Texts
View Single Post
10-05-19, 02:34 PM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,920
Originally Posted by Janede View Post
Code:
return "|cff%02x%02x%02x%.0f%%|r" or "",r,g,b,100*cur/max;
Since you split out the special handling for max HP, the highlighted section is no longer necessary.
The reason it was there in the first place was taking advantage of Lua's behavior of its logic operators to create an inline conditional statement. With the condition removed, the false-side return is just extra baggage.

Note: If you want to try this for yourself later, keep in mind the true-side return has to result in a true evaluation as well, or it'll fall through and give the false-side return instead.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote