turtle.getItemDetail
From ComputerCraft Wiki
Function turtle.getItemDetail | |
Returns the ID string, count and damage values of currently selected slot or, if specified, slotNum slot in a table format: { name = "modname:itemname", damage = 0, count = 1 }. Returns nil if there is no item in the specified or currently selected slot. | |
Syntax | turtle.getItemDetail([number slotNum]) |
Returns | table data |
Part of | ComputerCraft |
API | turtle |
Examples
Example | |
If there is an item in the currently selected slot, prints it's name, damage value and count. | |
Code |
local data = turtle.getItemDetail() if data then print("Item name: ", data.name) print("Item damage value: ", data.damage) print("Item count: ", data.count) end |
Example | |
If there is an item in the last slot, prints it's name. | |
Code |
local data = turtle.getItemDetail(16) if data then print("Item name: ", data.name) end |