@loud root I decided to first just get a print of specialization to keep things simple; with the code below, I am able to print the spec ID correctly, but for some reason, the more targets I select the more times print is being shown. So, when I select one target, print shows their spec ID once. When I change to another target, print now shows twice in chat. If I change again, print is shown 3 times.
The way I've set up aura is Text aura, with trigger as Player/Unit info -> Unit Characteristics -> Target, so that aura is triggered only when I select a target. The text is custom, so the below code is added in custom text box.
I understand I have to unregister the event at some point, just not sure how/where to do that. Code -
function()
local x = CreateFrame("Frame")
if CanInspect("target") then
NotifyInspect("target")
x:RegisterEvent("INSPECT_READY")
x:SetScript("OnEvent", function(self,event, ...)
local spec = GetInspectSpecialization("target")
print("Spec is", spec)
end)
end
end