Returns the number of companions you have.
count = GetNumCompanions("type")
- string - Type of companions to count: "CRITTER", or "MOUNT".
- number - The number of companions of a specific type.
The following snippet prints how many mini-pets the player has collected.
local count = GetNumCompanions("MOUNT"); print('Hello, I have collected a total of ' .. count .. ' mounts.');
Patch 5.0.4 / API (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.
Patch 3.0.2 / API (2008-10-14): Added.