Difference between revisions of "Turtle.getFuelLevel"

From ComputerCraft Wiki
Jump to: navigation, search
Line 29: Line 29:
 
<tr>
 
<tr>
 
<td style="padding-right: .5em; border-right: solid #DDD 1px;"><b>Output</b></td>
 
<td style="padding-right: .5em; border-right: solid #DDD 1px;"><b>Output</b></td>
<td style="padding-left: .5em;">Checks if the fuel tank is empty, if it is, it will fill the tank, else it wont do anything.</td>
+
<td style="padding-left: .5em;">Checks if the fuel tank is empty, if it is, it will fill the tank, otherwise it won't do anything.</td>
 
</tr>
 
</tr>
 
</table>
 
</table>

Revision as of 19:51, 5 September 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
 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.