In the meantime, you can try something like this if you encounter a guardian without witnessing its creation.
Lua Code:
local tip = CreateFrame('GameTooltip', 'GuardianOwnerTooltip', nil, 'GameTooltipTemplate')
function GetGuardianOwner(guid)
tip:SetOwner(WorldFrame, 'ANCHOR_NONE')
tip:SetHyperlink('unit:' .. guid or '')
local text = GuardianOwnerTooltipTextLeft2
return strmatch(text and text:GetText() or '', "^([^%s']+)'")
end
This example will probably only work on english clients, however there are a number of entries in GlobalStrings.lua that could potentially be matched against the line in the tooltip.
Lua Code:
UNITNAME_SUMMON_TITLE1 = "%s's Pet";
UNITNAME_SUMMON_TITLE10 = "%s's Mount";
UNITNAME_SUMMON_TITLE11 = "%s's Lightwell";
UNITNAME_SUMMON_TITLE12 = "%s's Butler";
UNITNAME_SUMMON_TITLE13 = "%s'aka";
UNITNAME_SUMMON_TITLE14 = "%s's Gateway";
UNITNAME_SUMMON_TITLE15 = "%s's Hatred";
UNITNAME_SUMMON_TITLE16 = "%s's Statue";
UNITNAME_SUMMON_TITLE17 = "%s's Spirit";
UNITNAME_SUMMON_TITLE18 = "%s's War Banner";
UNITNAME_SUMMON_TITLE19 = "%s's Heartwarmer";
UNITNAME_SUMMON_TITLE2 = "%s's Guardian";
UNITNAME_SUMMON_TITLE20 = "Hired by %s";
UNITNAME_SUMMON_TITLE21 = "Purchased by %s";
UNITNAME_SUMMON_TITLE22 = "%s's Pride";
UNITNAME_SUMMON_TITLE23 = "Twisted Image of %s";
UNITNAME_SUMMON_TITLE24 = "%s's Noodle Cart";
UNITNAME_SUMMON_TITLE3 = "%s's Minion";
UNITNAME_SUMMON_TITLE4 = "%s's Totem";
UNITNAME_SUMMON_TITLE5 = "%s's Companion";
UNITNAME_SUMMON_TITLE6 = "%s's Runeblade";
UNITNAME_SUMMON_TITLE7 = "%s's Construct";
UNITNAME_SUMMON_TITLE8 = "%s's Opponent";
UNITNAME_SUMMON_TITLE9 = "%s's Vehicle";