Lua functions

GetPet

Registered in this checkout as EQ2Emu_lua_GetPet; implementation found at WorldServer/Lua/LuaFunctions.cpp:5847.

Historical signature: GetPet(Spawn)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: GetPet(Spawn)

Description: Retrieves the pet entity of the given spawn, if one exists. For players, this returns their current summoned combat pet (summoner or necromancer pet, etc.), or for NPCs, a charmed pet or warder.

Parameters:

  • spawn (Spawn) - Spawn object representing spawn.

Return: Spawn object of the pet that the owner spawn currently has.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

Pet=GetPet(Caster)

Evidence: server/Spells/Mage/Summoner/EarthlyBrand.lua:17; binding EQ2Emu_lua_GetPet.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.