WoW:API UnitSex: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Use 1.11 codes (1=n, 2=m, 3=f). Reformat.)
Line 1: Line 1:
<center>'''UnitSex''' - ''Documentation by [[User:Itchyban|Itchyban]]''</center>
{{wowapi}}


== Synopsis ==
Returns the gender of the specified unit.
Returns the gender of the specified unit.


  gender_code = UnitSex("unit")
  gender_code = UnitSex("unit")


== Arguments ==
== Parameters ==
=== Arguments ===
:("unit")
:("unit")


:;unit : String -- The [[API TYPE UnitId|UnitId]] to query (e.g. "player", "party2", "pet", "target" etc.)
;unit : String -- The [[API TYPE UnitId|UnitId]] to query (e.g. "player", "party2", "pet", "target" etc.)


== Returns ==
=== Returns ===
:gender_code
:gender_code


:;gender_code : Integer -- 0 => Male, 1 => Female, 2 => Neuter/Unknown
;gender_code : Number:
:* 1 = Neutrum / Unknown
:* 2 = Male
:* 3 = Female


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)


In 1.11 For UnitSex("player") : 2 => Male, 3 => Female, Another ... I don't know ^^
== Example ==
[[User:Mortasgus|Mortasgus]] 20:08, 24 June 2006 (EDT)
local genderTable = { "neuter or unknown", "male", "female" };
DEFAULT_CHAT_FRAME:AddMessage('Target is ' .. genderTable[UnitSex("target")] .. '.');


== Example ==
<!-- begin code -->
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] .. '.');
<!-- end code -->
==== Result ====
==== Result ====
:Prints the target's gender to the chat frame. e.g.,
<!-- begin code -->
  Target is female.
  Target is female.
<!-- end code -->


== Details ==
== Details ==
: UnitSex("target") (or any likely any other unit) will return 2 (neuter/unknown) on "sheeped" mobs, no matter their "true" gender.
* UnitSex("target") will return 1 (neuter/unknown) on "sheeped" mobs, no matter their "true" gender. <small>(Needs reverification after 1.11)</small>
 
 
== Comments ==
 
Thanks to Octon for the nicely formatted [[API UnitName|UnitName]] page I "stole" for this.
 


----
* Prior to v1.11, the codes were 0=male, 1=female, 2=unknown.
{{WoW API}}

Revision as of 19:00, 25 June 2006

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.