Difference between revisions of "Turtle.getFuelLevel"
From ComputerCraft Wiki
m (Moved to CAT:LuaCoreFunctions) |
Bomb Bloke (Talk | contribs) (Wiki table.) |
||
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 the [[fuel]] level. Turtles may be configured to ignore the need for fuel via [[ComputerCraft.cfg]], in which case this command will always return "unlimited".<br><br> | |
− | + | ||
− | + | See also: [[Turtle.refuel|turtle.refuel()]], [[Turtle.getFuelLimit|turtle.getFuelLimit()]] | |
− | + | |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 | |
− | + | }} | |
− | + | }} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | end | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[Category:Lua_Core_Functions]] | [[Category:Lua_Core_Functions]] |
Revision as of 02:21, 29 March 2014
Function turtle.getFuelLevel | |
Returns the fuel level. Turtles may be configured to ignore the need for fuel via ComputerCraft.cfg, in which case this command will always return "unlimited". 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 |