Returns a summary of an item's stat bonuses. Keys in the table returned are the names of global variables containing the localized names of the stats (e.g. _G["ITEM_MOD_SPIRIT_SHORT"] = "Spirit", _G["ITEM_MOD_HIT_RATING_SHORT"] = "Hit Rating").

The optional argument returnTable allows for performance optimization in cases where this function is expected to be called repeatedly. Rather than creating new tables each time the function is called (eventually requiring garbage collection), an existing table can be recycled. (Note, however, that this function does not clear the table's contents; use wipe() first to guarantee consistent results.)


See also Item functions.

Signature:

statTable = GetItemStats("itemLink" [, returnTable])

Arguments:

  • itemLink - An item's hyperlink, or any string containing the itemString portion of an item link (string, hyperlink)
  • returnTable - Reference to a table to be filled with return values (table)

Returns:

  • statTable - A table listing the stat bonuses provided by the item (table)

Examples:

-- links to some early death knight gear for illustrating the example...
local _, swordLink = GetItemInfo("Greatsword of the Ebon Blade")
local _, ring1Link = GetItemInfo("Valanar's Signet Ring")

local stats = GetItemStats(swordLink)
for stat, value in pairs(stats) do print(value, _G[stat]) end
-- prints (approximately, on enUS client):
--   60.5 Damage Per Second
--   30 Strength
--   12 Hit Rating
--   24 Stamina

-- reusing the table...
GetItemStats(ring1Link, stats)
for stat, value in pairs(stats) do print(value, _G[stat]) end
--   60.5 Damage Per Second
--   12 Strength
--   12 Hit Rating
--   12 Critical Strike Rating
--   18 Stamina
-- oops, it overwrote the table from before, keeping some of the sword's stats...

-- let's try again and make sure it shows just the ring stats
wipe(stats)
GetItemStats(ring1Link, stats)
for stat, value in pairs(stats) do print(value, _G[stat]) end
--   12 Strength
--   12 Critical Strike Rating
--   18 Stamina