Difference between revisions of "Turtle.getFuelLevel"
From ComputerCraft Wiki
(Fixed Redlinks) |
|||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{lowercase}} | |
− | + | {{Function | |
− | + | |name=turtle.getFuelLevel | |
− | + | |api=turtle | |
− | + | |returns="unlimited" if fuel is disabled, otherwise the fuel level. | |
− | + | |addon=ComputerCraft | |
− | + | |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> | |
− | + | ||
− | + | Trivia: during the 1.4 beta, [[turtle.getFuelLevel]]() in softcore (that is now <var>turtleneedsfuel = 0</var>) returned 9000. | |
− | + | |examples= | |
− | + | {{Example | |
− | + | |desc=Attempts to refuel the turtle if the fuel tank is empty. | |
− | + | |code= if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then | |
− | + | turtle.refuel() | |
− | + | end | |
− | + | }} | |
− | + | }} | |
− | + | ||
− | + | ==See also== | |
− | + | *[[Turtle.refuel | Turtle.refuel()]] | |
− | + | *[[Turtle.getFuelLimit | Turtle.getFuelLimit()]] | |
− | + | ||
− | + | [[Category:Lua_Core_Functions]] | |
− | + | ||
− | end | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 04:23, 31 July 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. Trivia: during the 1.4 beta, turtle.getFuelLevel() in softcore (that is now turtleneedsfuel = 0) returned 9000. | |
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 |