WoW:API UnitSex: Difference between revisions
Jump to navigation
Jump to search
UnitSex - Documentation by Itchyban
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
genderTable[1] = "female"; | genderTable[1] = "female"; | ||
genderTable[2] = "neuter or unknown"; | genderTable[2] = "neuter or unknown"; | ||
local targetGenderCode = | local targetGenderCode = UnitSex("target"); | ||
DEFAULT_CHAT_FRAME:AddMessage('Target is ' .. genderTable[targetGenderCode] .. '.'); | DEFAULT_CHAT_FRAME:AddMessage('Target is ' .. genderTable[targetGenderCode] .. '.'); | ||
<!-- end code --> | <!-- end code --> |
Revision as of 12:02, 27 June 2005
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.