Difference between revisions of "Turtle.getFuelLevel"
From ComputerCraft Wiki
Line 21: | Line 21: | ||
<td style="padding-right: .5em; border-right: solid #DDD 1px;"><b>Code</b></td> | <td style="padding-right: .5em; border-right: solid #DDD 1px;"><b>Code</b></td> | ||
<td style="padding-left: .5em;"> | <td style="padding-left: .5em;"> | ||
− | <pre>if turtle.getFuelLevel() < 1 | + | <pre>if turtle.getFuelLevel() < 1 then |
turtle.refuel() | turtle.refuel() | ||
end | end |
Revision as of 10:33, 25 November 2012
Function turtle.getFuelLevel | |
Syntax | turtle.getFuelLevel() |
Returns | "unlimited" if fuel is disabled, otherwise the fuel level. |
Part of | ComputerCraft |
API | turtle |
Description | Returns the fuel level. |
Examples
Description | Fills the turtle with fuel if the fuel tank is empty |
Code |
if turtle.getFuelLevel() < 1 then turtle.refuel() end |
Output | Checks if the fuel tank is empty, if it is, it will fill the tank, otherwise it won't do anything. |