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 (Expanded)
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=If there is a block above the turtle digs it.
|code=turtle.detectUp()
+
|code= if '''turtle.detectUp()''' then
 +
  [[turtle.digUp]]()
 +
end
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Revision as of 16:51, 10 April 2014


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
If there is a block above the turtle digs it.
Code
if turtle.detectUp() then
  turtle.digUp()
end