View Single Post
11-18-10, 03:21 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by yj589794 View Post
What events is your tag registered to update from?
It's simply "UNIT_NAME_UPDATE"


Originally Posted by Ailae View Post
I suppose you could check that oldName isn't nil before trying to something with it. That'll probably stop the error, but doesn't really solve it. Can you "force" the event and add some printouts maybe?
How do I check if it isn't nil? What exactly do you mean with "force the event"? I mean switching targets = "UNIT_NAME_UPDATE", but like I said that works.


Btw, this is what I use for utf8sub, pretty straight forward, maybe except for the additional length check.

Code:
local utf8sub = function(string, i, dots)
	local bytes = string:len()
	if (bytes <= i) then
		return string
	else
		local len, pos = 0, 1
		while(pos <= bytes) do
			len = len + 1
			local c = string:byte(pos)
			if c > 240 then
				pos = pos + 4
			elseif c > 225 then
				pos = pos + 3
			elseif c > 192 then
				pos = pos + 2
			else
				pos = pos + 1
			end
			if (len == i) then break end
		end

		if (len == i and pos <= bytes) then
			return string:sub(1, pos - 1)..(dots and "..." or "")
		else
			return string
		end
	end
end

Edit:
"I do believe this is related to UTF8 and those special characters messing up the abbreviation."

I just tripple tested it and it doesn't matter if the player or player pet name contains special characters. It just happens.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."


Last edited by Dawn : 11-18-10 at 03:29 PM. Reason: tested and proofed wrong
  Reply With Quote