Originally Posted by @AlphaLemming
Garkin, is there a way to get the itemlink from the oldSlot-variable?
|
Table oldSlotData doesn't contain itemlink and if item doesn't exist, you can't get its itemlink.
However, if you need an itemlink, lets use workaround. I did something like that in my changes to Lost Treasure addon. Register for callback "SlotAdded" and then add itemlink to the slot table (in LT I'm adding itemId).
Lua Code:
local function OnSlotAdded(bagId, slotIndex, slotData)
slotData.itemLink = GetItemLink(bagId, slotIndex)
end
local function OnSlotRemoved(bagId, slotIndex, oldSlotData)
d(zo_strformat("Item <<t:1>> was removed from the inventory.", oldSlotData.itemLink)
end
SHARED_INVENTORY:RegisterCallback("SlotAdded", OnSlotAdded)
SHARED_INVENTORY:RegisterCallback("SlotRemoved", OnSlotRemoved)