In order to find the error please post the whole code and not the snippet here only.
It seems that your index variable is NIL somehow.
Btw: Why do you copy the bag and slot to new vars?
local bag, index = bagId, slotId -- ZO_Inventory_GetBagAndIndex(inventorySlot)
Just use bagId and slotId if they are defined via ZO_Inventory_GetBagAndIndex(inventorySlot) before.
|