WoW API: UnitRace

From AddOn Studio
Revision as of 20:33, 5 February 2018 by WoWWiki>Sinus.pi (Added detailed English race names, and Allied Races, too.)
Jump to navigation Jump to search

WoW API < UnitRace

Returns the race (Tauren, Orc, etc) of the specified unit.

race, raceEn = UnitRace("unit");

Arguments
("unit")
unit
String - The UnitId to get information from.

Returns


race
The localized race of the specified unit as a string. e.g. Tauren, Orc etc.
raceEn
The race in english as a string. Possible returns are: "Human", "NightElf", "Dwarf", "Gnome", "Draenei", "Worgen", "Orc", "Troll", "Scourge", "Tauren", "BloodElf", "Goblin", "Pandaren". As of Patch 7.3.5, Allied Races return: "VoidElf", "LightforgedDraenei", "HighmountainTauren" and "Nightborne".
(Note for undead: race returns "Undead" but raceEn returns "Scourge")

Example
local race = UnitRace("player");
ChatFrame1:AddMessage('Your player is a : ' .. race .. );
Result
Prints the player's race to the chat frame as

'Your player is a : Tauren'.  (Or whichever race the specified unit is)