WoW:API HasPetUI: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Corrected the return types, added a second example and removed an incorrect and rather confusing "result" clause.)
No edit summary
Line 29: Line 29:
     end
     end
   end
   end
----
;''Known Issues''
Does not work for Frost Mages' Water Elemental pets.  Even with a Water Elemental out (and the Pet UI showing), HasPetUI() returns nil,nil

Revision as of 21:37, 31 May 2010

WoW API < HasPetUI

Returns 1 if the player has a pet User Interface.

hasUI, isHunterPet = HasPetUI();

Arguments
none

Returns
hasUI, isHunterPet
hasUI
The number 1 if the player has a pet User Interface, nil if he does not.
isHunterPet
The number 1 if the pet is a hunter pet, nil if it is not.

Example
 if ( HasPetUI() ) then DoPetStuff(); end
Example
 local hasUI, isHunterPet = HasPetUI();
 if hasUI then
   if isHunterPet then
     DoHunterPetStuff(); -- For hunters
   else
     DoMinionStuff(); -- For Warlock minions
   end
 end

Known Issues

Does not work for Frost Mages' Water Elemental pets. Even with a Water Elemental out (and the Pet UI showing), HasPetUI() returns nil,nil