WoW:API UnitRace: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Added detailed English race names, and Allied Races, too.)
m (Added external link to a full list of race ids.)
Line 1: Line 1:
{{wowapi}}
{{wowapi}}Returns the race (Tauren, Orc, etc) of the specified unit.
 
Returns the race (Tauren, Orc, etc) of the specified unit.
  race, raceEn = UnitRace("unit");
  race, raceEn = UnitRace("unit");
----
----
Line 9: Line 6:
:("unit")
:("unit")


:;unit : String - The [[API TYPE UnitId|UnitId]] to get information from.
:;unit
:: String - The [[API TYPE UnitId|UnitId]] to get information from.
----
----
;''Returns''
;''Returns''




;race : The localized race of the specified unit as a string. e.g. Tauren, Orc etc.
;race
:;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".  
: The localized race of the specified unit as a string. e.g. Tauren, Orc etc.
:(Note for undead: race returns "Undead" but raceEn returns "Scourge")
:;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")
:See also: https://wow.gamepedia.com/RaceId


----
----

Revision as of 11:26, 3 September 2018

WoW API < UnitRaceReturns 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")
See also: https://wow.gamepedia.com/RaceId

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)