Difference between revisions of "Turtle.getItemDetail"
From ComputerCraft Wiki
MKlegoman357 (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=turtle.getItemDetail |args=[<nowiki/>{{type|number}} slotNum] |api=turtle |returns={{type|table}} data |addon=ComputerCraft |desc=Returns the ID...") |
Magiczocker (Talk | contribs) m |
||
(One intermediate revision by one other user not shown) | |||
Line 26: | Line 26: | ||
}} | }} | ||
}} | }} | ||
+ | |||
+ | ==See also== | ||
+ | *[[turtle.getItemCount]] | ||
+ | *[[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 |