View Single Post
12/26/14, 11:26 PM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
GetItemType() ?

Maybe not a bug, just an unwanted (by me) default action...

I'm trying to track down an error causing a crash. This is not the cause, but its something I noticed when trying to tack down the problem. In my code I have been checking to see if an item exists in a bag/slot by checking the itemType before attempting to do anything with the item. If it came back ITEMTYPE_NONE I assumed the item was moved, destroyed, sold, or I assumed it was just an invalid bag/slot passed in.

But I just found out that
  1. If the slotIndex is nil, like: GetItemType(1, nil) it seems to use slot 0 for that bag.
  2. If the bag is nil: GetItemType(nil, 33) it seems to default to bag 0
  3. If the bag is an erroneous number: GetItemType(12343224, nil) it is defaulting to bag 1.

Is there any other way to verify if the values for bag/slot are valid & correspond to an actual item that still exists in that bag/slot? (besides tediously checking the bag# & slot# against the available bags & slots)

Last edited by circonian : 12/26/14 at 11:41 PM.
  Reply With Quote