Difference between revisions of "Turtle.dig"
From ComputerCraft Wiki
| Line 10: | Line 10: | ||
{{Example | {{Example | ||
|desc=Digs the block in front of the turtle. | |desc=Digs the block in front of the turtle. | ||
| − | |code=print(turtle.dig()) | + | |code=[[print]](turtle.dig()) |
|output=true if the turtle could dig the block, false if it could not or no block present. | |output=true if the turtle could dig the block, false if it could not or no block present. | ||
| + | }} | ||
| + | {{Example | ||
| + | |desc=Digs the block in front of the turtle, but only if there is a block to dig (saves time). | ||
| + | |code=if [[turtle.detect]]() then | ||
| + | turtle.dig() | ||
| + | end | ||
| + | |output=the turtle digs if there is a block in front. | ||
}} | }} | ||
}} | }} | ||
Revision as of 21:07, 24 July 2012
| Attempts to dig the block in front of the turtle. | |
| Syntax | turtle.dig() |
| Returns | boolean whether the turtle succeeded in digging. |
| Part of | ComputerCraft |
| API | turtle |
Examples
| Digs the block in front of the turtle. | |
| Code |
print(turtle.dig()) |
| Output | true if the turtle could dig the block, false if it could not or no block present. |
| Digs the block in front of the turtle, but only if there is a block to dig (saves time). | |
| Code |
if turtle.detect() then turtle.dig() end |
| Output | the turtle digs if there is a block in front. |