View Single Post
02-04-09, 09:40 AM   #618
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by Bruners View Post
Code:
oUF.Tags["[shortname]"] = function(unit)
	return string.sub(UnitName(unit), 0, 12) or ""
end
Originally Posted by haste View Post
As of 1.3.2 tags should return nil (ie. nothing) when they fail. oUF uses this to determine if the tag should have a prefix/affix. It also adds the "" if not.

Another note is that string.sub is byte based, and not character. This has discussed numerous times before however.
So what you are saying is that it should be like this?
Code:
oUF.Tags["[shortname]"] = function(unit)
	if(not unit) then return end
	return string.sub(UnitName(unit), 0, 12)
end
or just return the output?

Last edited by Bruners : 02-04-09 at 09:45 AM.