Difference between revisions of "Turtle.getItemDetail"
From ComputerCraft Wiki
(Adding "see also".) |
Magiczocker (Talk | contribs) m |
||
Line 30: | Line 30: | ||
*[[turtle.getItemCount]] | *[[turtle.getItemCount]] | ||
*[[turtle.getItemSpace]] | *[[turtle.getItemSpace]] | ||
+ | [[Category:API Functions]] |
Latest revision as of 07:59, 4 August 2020
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 |