WoW:API UnitName: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Added further examples for valid unit specifications)
Line 8: Line 8:
:(String unit)
:(String unit)


:;arg1 : The unit to query (e.g. "player")
:;arg1 : The unit to query (e.g. "player", "party2", "pet", "target" etc.)


----
----

Revision as of 20:29, 4 January 2005

UnitName -Documentation by octon-

Returns the name of the specified unit.


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

Returns
name
name
The name of the specified unit as a string.

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.

Template:WoW API