WoW API: UnitSex

From AddOn Studio
Revision as of 19:00, 25 June 2006 by WoWWiki>Mikk (Use 1.11 codes (1=n, 2=m, 3=f). Reformat.)
Jump to navigation Jump to search

WoW API < UnitSex

Returns the gender of the specified unit.

gender_code = UnitSex("unit")

Parameters

Arguments

("unit")
unit
String -- The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)

Returns

gender_code
gender_code
Number:
  • 1 = Neutrum / Unknown
  • 2 = Male
  • 3 = Female


Example

local genderTable = { "neuter or unknown", "male", "female" };
DEFAULT_CHAT_FRAME:AddMessage('Target is ' .. genderTable[UnitSex("target")] .. '.');

Result

Target is female.

Details

  • UnitSex("target") will return 1 (neuter/unknown) on "sheeped" mobs, no matter their "true" gender. (Needs reverification after 1.11)
  • Prior to v1.11, the codes were 0=male, 1=female, 2=unknown.