Wikia

WoWWiki

Watchlist Recent changes

API GetUnitName

Main Menue



"I" iconThis function is implemented by FrameXML in FrameXML/UnitFrame.lua.


Returns the name and realm of the specified unit.

name = GetUnitName(unit, showServerName)


Contents

Parameters Edit

Arguments Edit

("unit", showServerName)
unit 
String - The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)
showServerName 
Boolean - If true, append " - [server name]" to name if it's available or FOREIGN_SERVER_LABEL (" (*)" on enUS locale) if nil or false.

Returns Edit

name 
A formatted string based on the return values of UnitName(unit).

ExampleEdit

print(GetUnitName("target"))

ResultEdit

Print "Bob" if Bob is your target and is on your server or "Bob - Server Name" if Bob is your target and is from a different server.

DetailsEdit

See UnitName for more details.

Pages on WoWWiki

95,750pages on
this wiki
Advertisement | Your ad here

Latest Photos

Add a Photo
58,025photos on this wiki
See more >

Recent Wiki Activity

See more >

Recent Questions

Around Wikia's network

Random Wiki