I solved it myself. Turns out that for recipes, which create usable items, the hyperlink returned by GetItem() does not match the returned id. The hyperlink is of the created item but the id is of the recipe. So when I use the returned id I am good.
Lua Code:
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, function(self)
local name, link, idFromTooltip = self:GetItem()
local idFromLink = tonumber(string_match(link, "^.-:(%d+):"))
if idFromTooltip ~= idFromLink then
print("This recipe has the id", idFromTooltip, "and creates another teaching item with the id", idFromLink)
print("Tooltip of created item:")
local tooltipLines = C_TooltipInfo.GetItemByID(idFromLink).lines
local numLines = 1
while tooltipLines[numLines] do
print(numLines .. ":", tooltipLines[numLines].args[2].stringVal)
numLines = numLines + 1
end
end
print("Tooltip of recipe:")
local tooltipLines = C_TooltipInfo.GetItemByID(idFromTooltip).lines
local numLines = 1
while tooltipLines[numLines] do
print(numLines .. ":", tooltipLines[numLines].args[2].stringVal)
numLines = numLines + 1
end
end)