WoW:API GetContainerItemLink: Difference between revisions
Jump to navigation
Jump to search
GetContainerItemLink - Documentation by VelvetPaw
No edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
<center>'''GetContainerItemLink''' - ''Documentation by VelvetPaw''</center> | |||
Returns the item link of the item located in bag# and slot#. | |||
ItemLink = GetContainerItemLink(bag,slot) | |||
== Parameters == | |||
=== Arguments === | |||
:bag, slot | |||
:;bag : Numeric - The number of the bag. Valid bags are 0-4. 0 is the backpack. | |||
:;slot : Numeric - The slot of the specified bag. Valid slots are 1 through BagSize. 1 is the left slot in the top row. | |||
=== Returns === | |||
:ItemLink | |||
:;ItemLink : Returns the ItemLink (The item link is the link when you shift-click an item while the chat edit box is visible). Returns nil if the slot of the specified bag is empty. | |||
=== Example === | |||
function UseContainerItemByName(SearchString) | |||
for bag=0,4 do | |||
for slot=1,GetContainerNumSlots(bag) do | |||
if (GetContainerItemLink(bag,slot)) then | |||
if (string.find(GetContainerItemLink(bag,slot), SearchString)) then | |||
UseContainerItem(bag,slot) | |||
end | |||
end | |||
end | |||
end | |||
end | |||
== Info == | |||
=== for .. do === | |||
:Look for the 'for .. do' block at the [http://www.lua.org/manual/5.0/ Reference Manual]. | |||
=== GetContainerNumSlots(bag) === | |||
:[[API GetContainerNumSlots|GetContainerNumSlots(index)]] - Gives you the number of slots available in the bag specified by the index. | |||
=== UseContainerItem(bag,slot) === | |||
:[[API UseContainerItem|UseContainerItem(bag,slot)]] - Uses an item located in bag# and slot#. | |||
=== string.find(string,pattern{,init{,plain}}) === | |||
:[[API strfind|strfind(string,pattern{,init{,plain}})]] - Look for match of pattern in string, optionally from specific location or using plain substring. | |||
---- | |||
__NOTOC__ | |||
{{Template:WoW API}} | |||
Revision as of 04:47, 2 August 2005
Returns the item link of the item located in bag# and slot#.
ItemLink = GetContainerItemLink(bag,slot)
Parameters
Arguments
- bag, slot
- bag
- Numeric - The number of the bag. Valid bags are 0-4. 0 is the backpack.
- slot
- Numeric - The slot of the specified bag. Valid slots are 1 through BagSize. 1 is the left slot in the top row.
Returns
- ItemLink
- ItemLink
- Returns the ItemLink (The item link is the link when you shift-click an item while the chat edit box is visible). Returns nil if the slot of the specified bag is empty.
Example
function UseContainerItemByName(SearchString)
for bag=0,4 do
for slot=1,GetContainerNumSlots(bag) do
if (GetContainerItemLink(bag,slot)) then
if (string.find(GetContainerItemLink(bag,slot), SearchString)) then
UseContainerItem(bag,slot)
end
end
end
end
end
Info
for .. do
- Look for the 'for .. do' block at the Reference Manual.
GetContainerNumSlots(bag)
- GetContainerNumSlots(index) - Gives you the number of slots available in the bag specified by the index.
UseContainerItem(bag,slot)
- UseContainerItem(bag,slot) - Uses an item located in bag# and slot#.
string.find(string,pattern{,init{,plain}})
- strfind(string,pattern{,init{,plain}}) - Look for match of pattern in string, optionally from specific location or using plain substring.