Lua Code:
function ADDITEMTOLISTFUNCTION()
if GameTooltip:IsShown() then
local _, itemLink = GameTooltip:GetItem()
if itemLink then
local itemID = GetItemInfoFromHyperlink(itemLink)
if itemID then
addItemToList(tableOfItems, itemID)
print(itemLink, "added to list")
end
end
end
end