Function: GetCosmeticPet(spawn)
Description: Return the entity's cosmetic pet from its original weak allocation reference. The native getter retains an operation loan and passes it into the current Lua invocation, so the returned actor remains readable through callbacks/retirement in that invocation. A different actor with the same runtime ID or address cannot inherit the relationship. Constructed and queued pets are available before active publication; stored userdata remains weak between calls.
Parameters:
spawn(Spawn) - Player or NPC entity that owns the pet.
Returns: The pet Spawn object, or nil if the owner is invalid, detached, has no pet in this category, or the pet has been retired or removed.