WoW:API UnitSex: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
Line 14: Line 14:
:gender_code
:gender_code


:;gender_code : Integer -- 0 => Male, 1 => Female, 2 => Neuter/Unknown  
:;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)
[[User:Sarf|Sarf]] 01:01, 16 June 2006 (EDT)


== Example ==
== Example ==

Revision as of 05:01, 16 June 2006

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

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.



Template:WoW API