View Single Post
04/16/18, 10:34 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Originally Posted by eventHandler View Post
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.
Careful. If what you want is exactly the name of the NPC (e.g. for data collection) you should definitely use the underlying API method GetUnitName in order to obtain that information, otherwise you can easily run into compatibility issues with other addons that change the formatting of the displayed name for example. On the other hand if you just want to mirror the control so the name is shown in a second place, you'd better use GetText instead, because then you automatically have the same changes from other addons applied without them needing to know about your addons functionality.

Aside from that you should be aware that GetText, classes and controls are not Lua language concepts. They are entirely ZOS' way of doing things in the UI.

Originally Posted by eventHandler View Post
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
Never even think about doing that! Changing the EsoStrings tables directly like that is a very bad idea and calls for all kinds of trouble. It could easily break other addons.