Difference between revisions of "Turtle.detectUp"

From ComputerCraft Wiki
Jump to: navigation, search
m (Corrected sentence casing (don't capitalize non-nouns in the middle of a sentence -_-), grammar)
m (Edited example description)
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
|args=
 
|args=
 
|api=turtle
 
|api=turtle
|returns={{type|boolean}} If turtle has detected a block above it.
+
|returns={{type|boolean}} is there a block above the turtle?
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|desc=Detects if there is a block above the turtle.
 
|desc=Detects if there is a block above the turtle.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Detects if there is a block above the turtle.
+
|desc=The turtle checks if there is a block above it, and if there is, it digs it.
|code=turtle.detectUp()
+
|code= if '''turtle.detectUp()''' then
 +
  [[turtle.digUp]]()
 +
end
 
}}
 
}}
 
}}
 
}}
 +
==See also==
 +
*[[turtle.detect]]
 +
*[[turtle.detectDown]]
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

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