WildStar:API TYPE Unit GetInventoryItems

From AddOn Studio
Jump to navigation Jump to search

API types < Unit:GetInventoryItems

Returns a list of the player's inventory items. Calling this on anyone but the current player returns an empty table.

local items = unit:GetInventoryItems()

Return Values[edit]

  • table - An array containing a player's items and the corresponding bag slot that they are found in.

Examples[edit]

function printItemNames()
    local player = GameLib.GetPlayerUnit()
    local items = player:GetInventoryItems()
    for key, value in pairs(items) do
        local item = value["itemInBag"]
        Print(item:GetName())
    end
end