WoW:API LootSlotHasItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with '=== Returns === <!-- List each return value, together with its type --> :;isLootItem : Boolean - is it a loot item instead of a coin == Example == <!-- If it helps, include an ...')
 
m (Move page script moved page API LootSlotHasItem to API LootSlotHasItem without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{wowapi}}
== Parameters ==
=== Arguments ===
:;slot : number - the loot slot.
=== Returns ===
=== Returns ===
<!-- List each return value, together with its type -->
<!-- List each return value, together with its type -->


:;isLootItem : Boolean - is it a loot item instead of a coin
:;isLootItem : boolean - is it a loot item instead of a coin


== Example ==
== Example ==
Line 9: Line 15:
  local itemLinkText
  local itemLinkText
  for i = 1, GetNumLootItems() do
  for i = 1, GetNumLootItems() do
     if (LootSlotIsItem(i)) then
     if (LootSlotHasItem(i)) then
           local iteminfo = GetLootSlotLink(i);
           local iteminfo = GetLootSlotLink(i);
           if itemLinkText == nil then
           if itemLinkText == nil then
Line 19: Line 25:
  end
  end
  DEFAULT_CHAT_FRAME:AddMessage(itemLinkText)
  DEFAULT_CHAT_FRAME:AddMessage(itemLinkText)
== Notes ==
* Renamed from LootSlotIsItem in 5.0.4
[[Category:World of Warcraft API]]

Latest revision as of 04:46, 15 August 2023

WoW API < LootSlotHasItem

Parameters[edit]

Arguments[edit]

slot
number - the loot slot.

Returns[edit]

isLootItem
boolean - is it a loot item instead of a coin

Example[edit]

Iterate through the items in the currently opened loot window an display them in the chat frame, side by side.

local itemLinkText
for i = 1, GetNumLootItems() do
    if (LootSlotHasItem(i)) then
         local iteminfo = GetLootSlotLink(i);
         if itemLinkText == nil then
              itemLinkText = iteminfo
         else
              itemLinkText = itemLinkText..iteminfo
         end
    end
end
DEFAULT_CHAT_FRAME:AddMessage(itemLinkText)

Notes[edit]

  • Renamed from LootSlotIsItem in 5.0.4