WoW:API GetContainerItemLink: Difference between revisions

Cleanup
(Corrected valid range of the parameter bagID.)
(Cleanup)
Line 25: Line 25:
== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
  function UseContainerItemByName(SearchString)
  function UseContainerItemByName(search)
   for bag=0,4 do
   for bag = 0,4 do
     for slot=1,GetContainerNumSlots(bag) do
     for slot = 1,GetContainerNumSlots(bag) do
       if (GetContainerItemLink(bag,slot)) then
       local item = GetContainerItemLink(bag,slot)
        if (string.find(GetContainerItemLink(bag,slot), SearchString)) then
      if item and item:find(search) then
          UseContainerItem(bag,slot)
        UseContainerItem(bag,slot)
        end
       end
       end
     end
     end
Anonymous user