GetNumCompanions

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 3.0.2 / 1.15.0

Returns the number of mounts.

count = GetNumCompanions(type)

Arguments

type
string - Type of companions to count: "CRITTER", or "MOUNT".

Returns

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

Example

The following snippet prints how many mounts the player has collected.

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

Patch changes

Mists of Pandaria Patch 5.0.4 (2012-08-28): Companions are now account-wide. This function only returns the correct value for mounts -- the non-combat companion count is based on the companions the character has acquired prior to the patch. Use the C_PetJournal API to query battle pet-related information.
Wrath-Logo-Small.png Patch 3.0.2 (2008-10-14): Added.