WoW:API UnitClass: Difference between revisions

no edit summary
(Returns the class (Mage, Warrior, etc) of the specified unit.)
 
No edit summary
Line 1: Line 1:
<center>'''UnitClass''' ''-Documentation by [[User:Octon|octon]]-''</center>
<center>'''UnitClass''' ''-Documentation by [[User:Octon|octon]]- Correction by Vjeux''</center>


Returns the class (Mage, Warrior, etc) of the specified unit.
Returns the class (Mage, Warrior, etc) of the specified unit.
Line 13: Line 13:
;''Returns''
;''Returns''


:class
:Localized Class
:;class : The class of the specified unit as a string.  e.g. Mage, Warrior, etc.
:;localizedclass : The localized class of the specified unit as a string.  e.g. Mage, Warrior, Guerrier, etc.
 
:English Class
:;englishclass : The fully english capitalized class of the specified unit as a string.  e.g. MAGE, WARRIOR, etc.
 


----
----
;''Example''
;''Example''
  local playerClass = UnitClass("player");
  local playerClass, englishClass = UnitClass("player");
  ChatFrame1:AddMessage('Your player is a : ' .. playerClass);
  ChatFrame1:AddMessage('Your player is a : ' .. playerClass .. '; ' .. englishClass);


;''Result''
;''Result''
  Prints the player's class to the chat frame as
  Prints the player's class to the chat frame as
   
   
  'Your player is a : Warrior'.  (Or whichever class the specified unit is)
  'Your player is a : Warrior; WARRIOR'.  (Or whichever class the specified unit is)


----
----
Line 30: Line 34:


: Returns the class (Mage, Warrior, etc) of the specified unit.
: Returns the class (Mage, Warrior, etc) of the specified unit.
: The second return is useful for localized addons.


----
----
{{Template:WoW API}}
{{Template:WoW API}}
Anonymous user