No categories assigned

LUA:GetOwner

LUA Functions: GetOwner()

Gets the owner of the given pet


Syntax

GetOwner(param1)


Parameters

Required - param1 (Spawn)
param1 is the spawn who's owner we want to get

Usage

function hailed(NPC, Spawn)
    if IsPet(NPC) then
        local owner = GetOwner(Spawn)
        if owner ~= nil then
            Say(NPC, "My owner is " .. GetName(Owner) .. ".")
        end
    end
end

This spawn script will respond with the name of its owner if it is a pet.

Notes

While not required it is good practice to make sure you are dealing with a pet before calling this function.