API UnitSex

Returns the gender of the specified unit. gender = UnitSex(unit)

Arguments

 * unit : string - UnitId

Returns

 * sex : number (nilable) - One of the following values, or nil if the unit does not exist
 * 1 = Neutrum or Unknown
 * 2 = Male
 * 3 = Female

Example
local genders = {"unknown", "male", "female"} if UnitExists("target") then print("The target is "..genders[UnitSex("target")]) end

Details

 * Most non-humanoid mobs/creatures will appear as Neutrum/Unknown.
 * Player characters currently appear as either Male or Female.

Patch changes

 * At an unknown time after 1.10, sheeped targets stopped returning 'unknown' and began providing the 'true' gender
 * At an unknown time after 1.10, sheeped targets stopped returning 'unknown' and began providing the 'true' gender