WoW:API UnitName: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Fixed result.)
Line 1: Line 1:
<center>'''UnitName''' ''-Documentation by [[User:Octon|octon]]-''</center>
<center>'''UnitName''' - ''Documentation by [[User:Octon|octon]]''</center>
 
name = UnitName("unit");


== Synopsis ==
Returns the name of the specified unit.
Returns the name of the specified unit.


----
name = UnitName("unit")
;''Arguments''


:(unit)
== Arguments ==
:("unit")


:;unit : String - The [[API TYPE UnitId|UnitId]] to query (e.g. "player", "party2", "pet", "target" etc.)
:;unit : String - The [[API TYPE UnitId|UnitId]] to query (e.g. "player", "party2", "pet", "target" etc.)


----
== Returns ==
;''Returns''
:name


:name
:;name : String - The name of the specified unit.
:;name : String - The name of the specified unit.


----
== Example ==
;''Example''
<!-- begin code -->
  local playerName = UnitName("player");
  local playerName = UnitName("player");
  ChatFrame1:AddMessage('Hi my name is: ' .. playerName);
  ChatFrame1:AddMessage('Hi my name is: ' .. playerName);
<!-- end code -->
==== Result ====
:Prints the player's name to the chat frame. e.g.
<!-- begin code -->
Hi my name is: Octon
<!-- end code -->


;''Result''
== Details ==
Prints the player's name to the chat frame as
: UnitName("player") (or any other unit) will return "Unknown Entity" (Actually the value of the UNKNOWNOBJECT global) if called before the unit in question has been fully loaded into the world.
'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.  This may be a bug.


----
----
__NOTOC__
{{Template:WoW API}}
{{Template:WoW API}}
[[Category:API Unit Functions|UnitName]]

Revision as of 07:07, 29 March 2005

UnitName - Documentation by octon

Synopsis

Returns the name of the specified unit.

name = UnitName("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. e.g.
Hi my name is: Octon

Details

UnitName("player") (or any other unit) will return "Unknown Entity" (Actually the value of the UNKNOWNOBJECT global) if called before the unit in question has been fully loaded into the world.

Template:WoW API