No categories assigned

LUA:GetOwner

Revision as of 17:18, 28 August 2013 by Jabantiz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.