I don't know Pitbull well enough to tell you exactly how but the process of getting a specialisation comes in two parts.
First determine if the target can be inspected and if so send an inspect request to the server.
Code:
if CanInspect("target") then
frame:RegisterEvent("INSPECT_READY")
NotifyInspect("target")
else
print("Can't inspect target")
end
Once the server has gathered the information it will send an "INSPECT_READY" event to the designated frame(s) which can then retrieve the information.
Frames OnEvent script for the "INSPECT_READY" event:
Code:
local spec_id = GetInspectSpecialization("target")
self:UnregisterEvent("INSPECT_READY")
ClearInspectPlayer()
local id, name, description, icon, background, role, class = GetSpecializationInfoByID(spec_id)
print(name) -- or set a texture to display the icon