m
→Common usage
m (→Common usage) |
|||
| Line 29: | Line 29: | ||
====Result==== | ====Result==== | ||
: Message box will pop-up with - " | : Message box will pop-up with - "Giantstalker's Helmet,4,Armor,1". | ||
==Details== | ==Details== | ||
| Line 36: | Line 36: | ||
: All string returns (itemName, itemType, itemSubType, itemEquipLoc(until 1.9)) are localized. | : All string returns (itemName, itemType, itemSubType, itemEquipLoc(until 1.9)) are localized. | ||
: itemString is a subset of an item's link, not the actual link returned from functions like GetContainerItemLink() | : itemString is a subset of an item's link, not the actual link returned from functions like GetContainerItemLink() | ||
== Common usage == | |||
function GetItemInfoFromItemLink(link) | |||
local itemId = nil; | |||
if ( type(link) == "string" ) then | |||
_,_, itemId = string.find(link, "item:(%d+):"); | |||
end | |||
if ( itemId ) then | |||
return GetItemInfo(itemId); | |||
end | |||
end | |||
local link = FunctionThatGetsItemLink(arg1, arg2); | |||
local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemTexture | |||
= GetItemInfoFromItemLink(link); | |||
-- do stuff with the info. | |||
Most people want to know how to get the item code needed to get item information (among them, me) so I decided to add it here. [[User:Sarf|Sarf]] | |||
---- | ---- | ||
__NOTOC__ | __NOTOC__ | ||
{{Template:WoW API}} | {{Template:WoW API}} | ||