Difference between revisions of "Turtle.attack"
From ComputerCraft Wiki
m (Moved to CAT:LuaCoreFunctions) |
(Corrected mapping from "Boolean" to "Boolean (type)") |
||
| Line 2: | Line 2: | ||
|name=turtle.attack | |name=turtle.attack | ||
|api=turtle | |api=turtle | ||
| − | |returns=[[boolean]] whether the turtle succeeded in attacking forward | + | |returns=[[boolean_(type)|boolean]] whether the turtle succeeded in attacking forward |
|addon=ComputerCraft | |addon=ComputerCraft | ||
|desc=Attempts to attack in front of the turtle. | |desc=Attempts to attack in front of the turtle. | ||
Revision as of 13:48, 30 November 2012
| Attempts to attack in front of the turtle. | |
| Syntax | turtle.attack() |
| Returns | boolean whether the turtle succeeded in attacking forward |
| Part of | ComputerCraft |
| API | turtle |
Examples
| Tries to attack in front of the turtle and outputs whether it worked or not. | |
| Code |
if turtle.attack() then print ("Turtle attacked in front.") else print ("Turtle could not attack.") end |
| Output | Turtle attacked in front. or Turtle could not attack. |