Skip to content

ItemType

Represents the type of an item, identified by a unique ID and a name.

Example: Check what the player holds

local player = spell.owner --[[@as Player]]
local item = player.mainHandItem
if item and item.type.id == "diamond_sword" then
  print("You hold a " .. item.type.name)
end

Fields

id: string — Read-Only

The unique identifier for the item type (e.g., "diamond_sword", "iron_pickaxe").

name: string — Read-Only

The human-readable name of the item type.