You need to include this function
Code:
-- string format
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 > 0 and c <= 127) then
pos = pos + 1
elseif (c >= 192 and c <= 223) then
pos = pos + 2
elseif (c >= 224 and c <= 239) then
pos = pos + 3
elseif (c >= 240 and c <= 247) then
pos = pos + 4
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
And put this in your nameplate's update function ...
Code:
local oldName = self.oldname:GetText()
local newName = (string.len(oldName) > 14) and string.gsub(oldName, "%s?(.[\128-\191]*)%S+%s", "%1. ") or oldName
self.name:SetText(newName)
The red number defines the maximum length of a name before it gets abbreviated.