Call as
Platform.items.identifier(item)
Record the dependency Platform.items.identifier, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.
What it does
Validates an item argument. Accepts a positive finite integer item ID or a nonempty string (an item name or link) of up to 1024 characters. Returns true, or nil with "restricted-value" for a secret value or "invalid-item" for anything else.
Arguments
| Name | Type | What it does |
|---|---|---|
item | any | Item ID, name or link to validate. |
Returns
| 1 | boolean | nil | True when item is acceptable; nil otherwise. |
|---|---|---|
| 2 | string | nil | restricted-value or invalid-item when rejected. |
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.
It reads no game API directly.
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.
How the addon calls it
Platform.items.GetItemInfoInstantlocal valid,reason=identifier(item)
Dependencies
platform(builtin:Platform/items.lua:platform)
Source
Platform/items.lua, line 20. Read only in game; Duplicate makes an editable copy.
Platform.items.identifier(item)
if not platform:CanReadValue(item) then return nil,"restricted-value" end
if type(item)=="number" and item>0 and item<math.huge and item%1==0 then return true end
if type(item)=="string" and #item>0 and #item<=1024 then return true end
return nil,"invalid-item"