Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Register
(Updated format, added UnitId link)
mNo edit summary
Line 30: Line 30:
 
;''Description''
 
;''Description''
   
: Returns the name of the specified unit.
+
: Returns the name of the specified unit. UnitName("player") will return "Unknown Entity" if called from a "PLAYER_ENTERING_WORLD" event.
   
 
----
 
----

Revision as of 01:15, 12 February 2005

UnitName -Documentation by octon-
name = UnitName("unit");

Returns the name of the specified unit.


Arguments
(unit)
unit
String - The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)

Returns
name
name
String - The name of the specified unit.

Example
local playerName = UnitName("player");
ChatFrame1:AddMessage('Hi my name is: ' .. playerName);
Result
Prints the player's name to the chat frame as
'Hi my name is: Octon'.  

Description
Returns the name of the specified unit. UnitName("player") will return "Unknown Entity" if called from a "PLAYER_ENTERING_WORLD" event.

Template:WoW API