Difference between revisions of "Turtle.inspectUp"

From ComputerCraft Wiki
Jump to: navigation, search
(Same as the other one [double-facepalm])
(Adding "see also".)
Line 19: Line 19:
 
* Returns false when there is nothing (air) above the Turtle.
 
* Returns false when there is nothing (air) above the Turtle.
 
}}
 
}}
 +
 +
==See also==
 +
*[[turtle.inspect]]
 +
*[[turtle.inspectDown]]

Revision as of 17:56, 22 April 2015


Grid Redstone.png  Function turtle.inspectUp
Returns the ID string and metadata of the block above the Turtle in a table format: { name = "modname:blockname", metadata = 0 }.
Syntax turtle.inspectUp()
Returns boolean success, table data/string error message
Part of ComputerCraft
API turtle

Examples

Grid paper.png  Example
If there is a block above the turtle, prints it's name and metadata.
Code
local success, data = turtle.inspectUp()

if success then
  print("Block name: ", data.name)
  print("Block metadata: ", data.metadata)
end

Additional Notes

  • Returns false when there is nothing (air) above the Turtle.


See also