Originally Posted by yj589794
What events is your tag registered to update from?
|
It's simply "UNIT_NAME_UPDATE"
Originally Posted by Ailae
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.