View Single Post
07-28-09, 01:31 PM   #35
jadakren
A Flamescale Wyrmkin
 
jadakren's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 103
Originally Posted by Qupe View Post
I also used this DogTag when I was using Pitbull. I'm not anywhere near a master of lua at all so I was wondering where in the layout (or wherever) I would put this code to produce the abbreviated name.
Code:
--this part goes near the top of your layout, before the style function

oUF.Tags["[abbreviatedname]"] = [[function(u)
 local name = UnitName(u)
 return (string.len(name) > 10) and string.gsub(name, "%s?(.)%S+%s", "%1. ") or name
end
	]]
oUF.TagEvents["[abbreviatedname]"] = "UNIT_NAME_UPDATE"


-- snip, next part is inside your style function.

local name = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft')
name:SetPoint('LEFT',self.Health) --replace this line with your own positioning code
name:SetPoint('RIGHT',self.Health) --replace this line with your own positioning code
self:Tag(name, '[abbreviatedname]')
self.Name = name
  Reply With Quote