Returns a string summarizing a unit's name and server

See also Unit functions.


nameString = GetUnitName("unit", showServerName)


  • unit - Unit to query (string, unitID)
  • showServerName - True to include the server name in the return value if the unit is not from the same server as the player; false to only include a short label in such circumstances (boolean)


  • nameString - The unit's name, possibly followed by the name of the unit's home server or a label indicating the unit is not from the player's server (string)
This function is not a C API but a Lua function declared in Blizzard's default user interface. Its implementation can be viewed by extracting the addon data using the Addon Kit provided by Blizzard.
This function is defined by the default user interface in Lua. You can find the definition by examining the FrameXML code for the default UI,