View Single Post
11/20/14, 03:29 PM   #12
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by circonian View Post
But, Is there a reason you don't just check the inventory slots table instead of calling GetItemType and comparing it to see if its ITEMTYPE_NONE?
Wouldn't that be even faster?

No particular reason. GetItemType is what I learned first, is easy to remember and also shorter, dunno about speed Although if you wanted to use pre-cached slot data, you should probably use SHARED_INVENTORY:GenerateSingleSlotData. That's what PLAYER_INVENTORY.inventories[iInventory].slots are initialized with:
Lua Code:
  1. -- ingame/inventory/inventory.lua
  2. inventory.slots[slotIndex] = SHARED_INVENTORY:GenerateSingleSlotData(bagId, slotIndex)
  Reply With Quote