From f0b547394538b5b1f7e51dfcadeb50399e0c6970 Mon Sep 17 00:00:00 2001 From: Mats391 Date: Tue, 30 Dec 2025 17:14:02 +0100 Subject: [PATCH] Updating documentation --- SCRIPTS.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/SCRIPTS.md b/SCRIPTS.md index 7d2621b..0a44326 100644 --- a/SCRIPTS.md +++ b/SCRIPTS.md @@ -56,7 +56,7 @@ The following functions use reusable table references: - **`GetCastInfo()`** - Returns cast information table - **`GetEquippedItems([unitToken])`** - Returns equipped items table -- **`GetBagItems()`** - Returns bag items table +- **`GetBagItems([bagIndex])`** - Returns bag items table - **`GetBagItem(bagIndex, slot)`** - Returns item info table - **`GetEquippedItem(unitToken, slot)`** - Returns item info table - **`GetSpellIdCooldown(spellId)`** - Returns cooldown detail table @@ -338,8 +338,8 @@ if helm and helm.durability then end ``` -#### GetBagItems() -Returns a nested table reference containing all items in all bags (including bank if open). +#### GetBagItems([bagIndex]) +If no bagIndex is specified, the function returns a nested table reference containing all items in all bags (including bank if open). With specified index, it only returns the contents of that bag **Returns:** - A Lua table reference with bag indices as keys and bag contents as values @@ -367,6 +367,12 @@ for bagIndex, bagContents in pairs(allItems) do end end +-- Get all items in backbag +local bagContents = GetBagItems(0) +for slot, itemInfo in pairs(bagContents) do + print(" Slot " .. slot .. ": " .. itemInfo.itemId .. " (x" .. itemInfo.stackCount .. ")") +end + -- Count total number of a specific item local function CountItem(itemId) local total = 0