WoW:API UnitSex
Jump to navigation
Jump to search
Synopsis
Returns the gender of the specified unit.
gender_code = UnitSex("unit")
Arguments
- ("unit")
- unit
- String -- The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)
Returns
- gender_code
- gender_code
- Integer -- 0 => Male, 1 => Female, 2 => Neuter/Unknown
NOTE: In 1.11 this will change to 0 => Unknown, 1 => Male and 2=> Female (I think) Sarf 01:01, 16 June 2006 (EDT)
Example
local genderTable = {}; genderTable[0] = "male"; genderTable[1] = "female"; genderTable[2] = "neuter or unknown"; local targetGenderCode = UnitSex("target"); DEFAULT_CHAT_FRAME:AddMessage('Target is ' .. genderTable[targetGenderCode] .. '.');
Result
- Prints the target's gender to the chat frame. e.g.,
Target is female.
Details
- UnitSex("target") (or any likely any other unit) will return 2 (neuter/unknown) on "sheeped" mobs, no matter their "true" gender.
Comments
Thanks to Octon for the nicely formatted UnitName page I "stole" for this.