turtle.getItemDetail

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  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

Grid paper.png  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



Grid paper.png  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


Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox