WoW:API GetNumCompanions: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (→‎Result: fix typo.)
m (Move page script moved page API GetNumCompanions to API GetNumCompanions without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}}  
 
 
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
Returns the number of companions you have.  New in [[Patch 3.0]]
Returns the number of companions you have.  New in [[Patch 3.0]]
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  count = GetNumCompanions("type")
  count = GetNumCompanions("type")


== Arguments ==
;type : String ([[companionType]]) - Type of companions to count ("CRITTER", or "MOUNT")


== Parameters ==
== Returns ==
=== Arguments ===
;count : Number - The number of companions of a specific type.
<!-- List each argument, together with its type -->
:("type")
 
:;type : String - The [[API TYPE TypeId|TypeID]] to query (e.g. "CRITTER", or "MOUNT")
 
=== Returns ===
<!-- List each return value, together with its type -->
:;count : Integer - The number of companions of a specific type.


== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
The following snippet prints how many mini-pets the player has collected.
<!-- begin code -->
  local count = GetNumCompanions("CRITTER");
  local count = GetNumCompanions("CRITTER");
  ChatFrame1:AddMessage('Hello, I have collected a total of ' .. count .. ' pets.');
  print('Hello, I have collected a total of ' .. count .. ' pets.');
<!-- end code -->
 
====Result====
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->
:Prints how many mini-pets the player has collected. e.g.
<!-- begin code -->
Hello, I have collected a total of 34 pets.
<!-- end code -->
[[Category:World of Warcraft API]]

Latest revision as of 04:46, 15 August 2023

WoW API < GetNumCompanions

Returns the number of companions you have. New in Patch 3.0

count = GetNumCompanions("type")

Arguments[edit]

type
String (companionType) - Type of companions to count ("CRITTER", or "MOUNT")

Returns[edit]

count
Number - The number of companions of a specific type.

Example[edit]

The following snippet prints how many mini-pets the player has collected.

local count = GetNumCompanions("CRITTER");
print('Hello, I have collected a total of ' .. count .. ' pets.');