Here's a snippet from my addon where I needed to get information from that, feel free to pick it apart if you just need a few select things.
Code:
function RecievedSpellLink() -- for spell info
for i = 1, select("#", arg2) do
RecievedSpellLinkToBePrinted=((select(1,GetSpellLink(Query))))
end
end
function RecievedSpellInfo()
for i = 1, select("#", name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange) do
SortResources() --Determines when i == 6, to print correctly
if i == 1 then
if (select(i,GetSpellInfo(Query))) == nil then
--spell does not exist
print("\124cFF00FFFFSpell |r"..Query.."\124cFF00FFFF does not exist.")
return;
else
--spell does exist
RecievedSpellLink() --sorts link arguments cleanly
print("\124cFF00FFFFName:|r "..RecievedSpellLinkToBePrinted)
end
elseif i == 2 then
if (select(i,GetSpellInfo(Query))) == nil then
--no rank exists, but keep going, so no return
else
print("\124cFF00FFFFRank:|r "..(select(i,GetSpellInfo(Query))))
--rank exists, continue
end
elseif i == 3 then
print("\124cFF00FFFFIcon:|r "..(select(i,GetSpellInfo(Query))))
elseif i == 4 then
print("\124cFF00FFFFCost:|r "..(select(i,GetSpellInfo(Query))).."\124cFF00FFFF points of "..ResourceRequested)
elseif i == 5 then
--nil value
elseif i == 6 then
--nil value
elseif i == 7 then
print("\124cFF00FFFFCast Time:|r "..(select(i,GetSpellInfo(Query))).."\124cFF00FFFF milliseconds")
elseif i == 8 then
print("\124cFF00FFFFMinimum Range:|r "..(select(i,GetSpellInfo(Query))))
elseif i == 9 then
print("\124cFF00FFFFMaximum Range:|r "..(select(i,GetSpellInfo(Query))))
else
print("No Information Cached")
end
end
end
function SortResources() --for spell info
if (select(6,GetSpellInfo(Query))) == 0 then
ResourceRequested=("\124cFF0000FFMana")
elseif (select(6,GetSpellInfo(Query))) == -2 then
ResourceRequested=("\124cFFE000Health")
elseif (select(6,GetSpellInfo(Query))) == 1 then
ResourceRequested=("\124cFFFF0000Rage")
elseif (select(6,GetSpellInfo(Query))) == 2 then
ResourceRequested=("\124cFF00E000Focus")
elseif (select(6,GetSpellInfo(Query))) == 3 then
ResourceRequested=("\124cFF0000E0Energy")
elseif (select(6,GetSpellInfo(Query))) == 4 then
ResourceRequested=("\124cFF00FFB0Happiness")
elseif (select(6,GetSpellInfo(Query))) == 5 then
ResourceRequested=("\124cFFcebeceRune")
elseif (select(6,GetSpellInfo(Query))) == 6 then
ResourceRequested=("\124cFF00E0FFRunic Power")
else
ResourceRequested=("No Resource")
end
end