View Single Post
09-13-09, 04:26 PM   #1165
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Wimpface View Post
So here I am, writing yet another oUF layout based on p3lim's great work. And also, here I am, finding yet another problem writing tags for myself to use.

I'm trying to get my power text for players/pets powertype-colored and shortened to "11.2k" for example. But this just won't work the way I want it to.
Code:
oUF.Tags['[ppower]'] = function(unit)
	local _, str = UnitPowerType(unit)
	local mini = UnitPower(unit)
	return ('%s%s|r'):format(hex(colors.power[str] or {1, 1, 1}), shortVal(mini))
end
%d needs a digit, while 'k' is a letter, you would need %s so it accept strings.