ItemLocationMixin
Jump to navigation
Jump to search
ItemLocationMixin objects can only be created for items in your equipment or inventory.
API
- ItemLocation:CreateEmpty() : itemLocation - Creates an empty object.
- ItemLocation:CreateFromBagAndSlot(bagID, slotIndex) : itemLocation - Creates an object from a bagID and slotIndex.
- ItemLocation:CreateFromEquipmentSlot(equipmentSlotIndex) : itemLocation - Creates an object from an inventorySlotId.
Methods
- ItemLocationMixin:Clear()
- ItemLocationMixin:SetBagAndSlot(bagID, slotIndex)
- ItemLocationMixin:GetBagAndSlot() : bagID, slotIndex
- ItemLocationMixin:SetEquipmentSlot(equipmentSlotIndex)
- ItemLocationMixin:GetEquipmentSlot() : equipmentSlotIndex
- ItemLocationMixin:IsEquipmentSlot() : boolean
- ItemLocationMixin:IsBagAndSlot() : boolean
- ItemLocationMixin:HasAnyLocation() : boolean
- ItemLocationMixin:IsValid() : boolean
- ItemLocationMixin:IsEqualToBagAndSlot(bagID, slotIndex) : boolean
- ItemLocationMixin:IsEqualToEquipmentSlot(equipmentSlotIndex) : boolean
- ItemLocationMixin:IsEqualTo(itemLocation) : boolean
Example
Prints the ID and name of the item in your head slot.
local itemLoc = ItemLocation:CreateFromEquipmentSlot(INVSLOT_HEAD)
if itemLoc:IsValid() then
local id = C_Item.GetItemID(itemLoc)
local name = C_Item.GetItemName(itemLoc)
print(id, name) -- 21524, "Red Winter Hat"
end
The minimal representation is a table with the equipmentSlotIndex
or bagID, slotIndex
fields.
/dump C_Item.GetItemName({equipmentSlotIndex = 1})
Used by
Patch changes
Patch 8.0.1 (2018-07-17): Added.