Difference between revisions of "Turtle.getFuelLevel"

From ComputerCraft Wiki
Jump to: navigation, search
Line 4: Line 4:
 
<td style="border-color: black; padding: .2em; padding-left: .4em;">turtle.getFuelLevel()</td></tr>
 
<td style="border-color: black; padding: .2em; padding-left: .4em;">turtle.getFuelLevel()</td></tr>
 
<tr style="background-color: #FFFFFF;"><td style="border-right: solid black 1px; padding: .2em; width: 10%; font-weight: bold;">Returns</td>
 
<tr style="background-color: #FFFFFF;"><td style="border-right: solid black 1px; padding: .2em; width: 10%; font-weight: bold;">Returns</td>
<td style="border-color: black; padding: .2em; padding-left: .4em;"> "unlimited" if [[disabled fuel]], else the fuel level.</td></tr>
+
<td style="border-color: black; padding: .2em; padding-left: .4em;"> "unlimited" if fuel is disabled, otherwise the fuel level.</td></tr>
 
<tr style="background-color: #E8E8E8;"><td style="border-right: solid black 1px; padding: .2em; width: 10%; font-weight: bold;">Part of</td>
 
<tr style="background-color: #E8E8E8;"><td style="border-right: solid black 1px; padding: .2em; width: 10%; font-weight: bold;">Part of</td>
 
<td style="border-color: black; padding: .2em; padding-left: .4em;">[[ComputerCraft]]</td></tr>
 
<td style="border-color: black; padding: .2em; padding-left: .4em;">[[ComputerCraft]]</td></tr>

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, else it wont do anything.