Wowpedia

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

READ MORE

Wowpedia
mNo edit summary
No edit summary
Line 35: Line 35:
 
: 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.
 
: The second return is useful for localized addons.
  +
   
 
----
 
----
{{Template:WoW API}}
+
{{WoW API}}
[[Category:API Functions|UnitClass]]
 
[[Category:API Unit Functions|UnitClass]]
 

Revision as of 05:32, 4 January 2006

UnitClass -Documentation by octon- Correction by Vjeux

Returns the class (Mage, Warrior, etc) of the specified unit.


Arguments
(String unit)
arg1
The unit to query (e.g. "player")

Returns
Localized Class
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
local playerClass, englishClass = UnitClass("player");
ChatFrame1:AddMessage('Your player is a : ' .. playerClass .. '; ' .. englishClass);
Result
Prints the player's class to the chat frame as

'Your player is a : Warrior; WARRIOR'.  (Or whichever class the specified unit is)

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



Template:WoW API