WoW:API HasPetUI: Difference between revisions

Corrected the return types, added a second example and removed an incorrect and rather confusing "result" clause.
No edit summary
(Corrected the return types, added a second example and removed an incorrect and rather confusing "result" clause.)
Line 1: Line 1:
{{wowapi}}
{{wowapi}}
Returns true if the player has a pet User Interface.
Returns <tt>1</tt> if the player has a pet User Interface.


  hasUI = HasPetUI();
  hasUI, isHunterPet = HasPetUI();


----
----
Line 13: Line 13:


:hasUI, isHunterPet
:hasUI, isHunterPet
:;hasUI :Boolean - <tt>true</tt> if the player has a pet User Interface.
:;hasUI :The number <tt>1</tt> if the player has a pet User Interface, <tt>nil</tt> if he does not.
:;isHunterPet :Boolean - <tt>true</tt> if the pet is a hunter pet
:;isHunterPet :The number <tt>1</tt> if the pet is a hunter pet, <tt>nil</tt> if it is not.


----
----
Line 20: Line 20:
   if ( HasPetUI() ) then DoPetStuff(); end
   if ( HasPetUI() ) then DoPetStuff(); end


;''Result''
;''Example''
true | false
  local hasUI, isHunterPet = HasPetUI();
  if hasUI then
    if isHunterPet then
      DoHunterPetStuff(); -- For hunters
    else
      DoMinionStuff(); -- For Warlock minions
    end
  end
Anonymous user