Reference › Function reference › Platform

Platform.items.GetItemInfoInstant

public

Call as

addon.Platform:GetItemInfoInstant(item)

Available directly through addon; no dependency is needed.

What it does

Read normalized native item classification metadata. The record contains canonical itemID, classID and subClassID, plus equipLoc, the non-localized INVTYPE_* equip location token, when it is readable and nonempty; it does not require loaded item display text. Missing, failed, malformed or restricted metadata returns nil with a reason.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).
itemnumber | stringPositive item ID or native-recognized item name/link to classify.

Returns

1table | nilReadable canonical item classification record (itemID, classID, subClassID and optional equipLoc), or nil when unavailable.
2string | nilValidation or availability reason for a nil result.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
C_Item.GetItemInfoInstantClassic EraTBC AnniversaryClassic progressionForeverRetail
GetItemInfoInstantClassic EraTBC AnniversaryClassic progressionForeverRetail

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

Example

local item = addon.Platform:GetItemInfoInstant(5512) -- Healthstone
if not item then return nil end
return item.classID == 0 -- consumable

Dependencies

Source

Platform/items.lua, line 132. Read only in game; Duplicate makes an editable copy.

Platform.items.GetItemInfoInstant(self, item)
    local valid,reason=identifier(item)
    if not valid then return nil,reason end
    local fn=C_Item and C_Item.GetItemInfoInstant
    if type(fn)~='function' then fn=GetItemInfoInstant end
    if type(fn)~='function' then return nil,'missing-api' end
    local ok,tuple=pcall(function() return {fn(item)} end)
    if not ok then return nil,'api-error' end
    local id,class,subclass=tuple[1],tuple[6],tuple[7]
    if not self:CanReadValue(id) or not self:CanReadValue(class) or not self:CanReadValue(subclass) then return nil,'restricted-value' end
    if id==nil then return nil,'item-data-unavailable' end
    if not finite(id) or id<=0 or id%1~=0 or not finite(class) or class%1~=0
        or not finite(subclass) or subclass%1~=0 or type(item)=='number' and id~=item then return nil,'invalid-api-result' end
    -- The equip location is a non-localized INVTYPE_* token (two-hand,
    -- shield, ...). An empty or unreadable token is simply absent.
    local equipLoc=tuple[4]
    if not self:CanReadValue(equipLoc) or type(equipLoc)~='string' or equipLoc=='' then equipLoc=nil end
    return {itemID=id,classID=class,subClassID=subclass,equipLoc=equipLoc}

Back to Function reference