Originally Posted by Dolgubon
That's what I use, but I would still suggest getunitname. The interact window method requires adding - to either side (or taking them out)
|
I'm not sure I follow your second sentence.
:GetText() returns a new copy of the text, it doesn't remove the text from the source or give you a "pointer" to the current text (to be able to modify it directly). That's why you still have to use :SetText() to change the contents.
The reason I wouldn't use GetUnitName(), is because it's so specific and not re-usable; it doesn't provide any insight into how to find other information through trial and error. Whereas :GetText() works for a lot of different classes, and provides subtle insight into the lua language concepts.
Actually, you meant the dash character; I thought you were separating a thought. My addon removes those, so I wasn't thinking about them.
name = string.gsub(ZO_InteractWindowTargetAreaTitle:GetText(), '[^%w\' ]', '') would almost work, if not for Razum-dar and his ilk.
So, you'd have to check if the ends are dashes, if you didn't want to
EsoStrings[SI_INTERACT_TITLE_FORMAT] = <<1>> to just remove them always