WoW:API UnitSex: Difference between revisions

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


  Thanks to Octon for the nicely formatted [[API UnitName|UnitName]] page I "stole" for this.
  Thanks to Octon for the nicely formatted [[API UnitName|UnitName]] page I "stole" for this.


----
----
__NOTOC__
{{WoW API}}
{{Template:WoW API}}
[[Category:API Unit Functions|UnitSex]]

Revision as of 05:38, 4 January 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


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