WoW:API UnitSex

From AddOn Studio
Revision as of 05:38, 4 January 2006 by WoWWiki>Muert
Jump to navigation Jump to search
UnitSex - Documentation by Itchyban

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


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.



Template:WoW API