Skip to content

Instantly share code, notes, and snippets.

@dkrusky
Created January 9, 2017 10:49
Show Gist options
  • Save dkrusky/f2d3e76aa710a18e485ec62b000b7e61 to your computer and use it in GitHub Desktop.
Save dkrusky/f2d3e76aa710a18e485ec62b000b7e61 to your computer and use it in GitHub Desktop.
Loop through all items in bags in World of Warcraft
local function countItem(item)
local c
for bag=0,NUM_BAG_SLOTS do
for slot=1,GetContainerNumSlots(bag) do
if item == GetContainerItemID(bag,slot) then
c=c+(select(2,GetContainerItemInfo(bag,slot)))
end
end
end
return c
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment