Difference between revisions of "Turtle.detectUp"

From ComputerCraft Wiki
Jump to: navigation, search
(Adding "see also".)
m (Edited example description)
 
Line 9: Line 9:
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=If there is a block above the turtle digs it.
+
|desc=The turtle checks if there is a block above it, and if there is, it digs it.
 
|code= if '''turtle.detectUp()''' then
 
|code= if '''turtle.detectUp()''' then
 
   [[turtle.digUp]]()
 
   [[turtle.digUp]]()

Latest revision as of 12:25, 14 August 2015


Grid Redstone.png  Function turtle.detectUp
Detects if there is a block above the turtle.
Syntax turtle.detectUp()
Returns boolean is there a block above the turtle?
Part of ComputerCraft
API turtle

Examples

Grid paper.png  Example
The turtle checks if there is a block above it, and if there is, it digs it.
Code
if turtle.detectUp() then
  turtle.digUp()
end


See also