Difference between revisions of "Turtle.getFuelLevel"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) (Wiki table.) |
(Clarifying what is fuel level, and adding a note about loosing fuel.) |
||
Line 5: | Line 5: | ||
|returns="unlimited" if fuel is disabled, otherwise the fuel level. | |returns="unlimited" if fuel is disabled, otherwise the fuel level. | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Returns | + | |desc=Returns how much [[fuel]] is inside the specific turtle. Turtles may be configured to ignore the need for fuel via [[ComputerCraft.cfg]], in which case this command will always return "unlimited". Turtles loose their fuel when destroyed, if they don't have a [[label]].<br><br> |
See also: [[Turtle.refuel|turtle.refuel()]], [[Turtle.getFuelLimit|turtle.getFuelLimit()]] | See also: [[Turtle.refuel|turtle.refuel()]], [[Turtle.getFuelLimit|turtle.getFuelLimit()]] |
Revision as of 14:24, 21 April 2015
Function turtle.getFuelLevel | |
Returns how much fuel is inside the specific turtle. Turtles may be configured to ignore the need for fuel via ComputerCraft.cfg, in which case this command will always return "unlimited". Turtles loose their fuel when destroyed, if they don't have a label. See also: turtle.refuel(), turtle.getFuelLimit() | |
Syntax | turtle.getFuelLevel() |
Returns | "unlimited" if fuel is disabled, otherwise the fuel level. |
Part of | ComputerCraft |
API | turtle |
Examples
Example | |
Attempts to refuel the turtle if the fuel tank is empty. | |
Code |
if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then turtle.refuel() end |