Difference between revisions of "Turtle.getFuelLimit"
From ComputerCraft Wiki
(Created page) |
Bomb Bloke (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
{{lowercase}} | {{lowercase}} | ||
+ | {{Function | ||
+ | |name=turtle.getFuelLimit | ||
+ | |api=turtle | ||
+ | |returns="unlimited" if fuel is disabled, otherwise the maximum fuel level. | ||
+ | |addon=ComputerCraft | ||
+ | |desc=Added by version 1.6 of ComputerCraft, this command returns the maximum amount of [[fuel]] a [[turtle]] may store. By default, a regular turtle may hold 20,000 units, and an advanced model 100,000 units; both values can be changed in [[ComputerCraft.cfg]].<br><br> | ||
+ | |||
+ | In builds prior to 1.6, turtles may store practically unlimited amounts of fuel.<br><br> | ||
+ | |||
+ | See also: [[Turtle.getFuelLevel|turtle.getFuelLevel()]], [[Turtle.refuel|turtle.refuel()]] | ||
+ | |examples= | ||
+ | {{Example | ||
+ | |desc=If a fuel limit is present, consumes fuel items from the selected slot one at a time, until the storage limit is reached; otherwise consumes the entire stack. | ||
+ | |code= if turtle.getFuelLevel() ~= "unlimited" then | ||
+ | if turtle.getFuelLimit then | ||
+ | while turtle.getFuelLevel() < turtle.getFuelLimit() and turtle.getItemCount(turtle.getSelectedSlot()) > 0 do | ||
+ | turtle.refuel(1) | ||
+ | end | ||
+ | else | ||
+ | turtle.refuel() | ||
+ | end | ||
+ | end | ||
+ | }} | ||
+ | }} | ||
+ | |||
+ | [[Category:API_Functions]] |
Latest revision as of 01:13, 29 March 2014
Function turtle.getFuelLimit | |
Added by version 1.6 of ComputerCraft, this command returns the maximum amount of fuel a turtle may store. By default, a regular turtle may hold 20,000 units, and an advanced model 100,000 units; both values can be changed in ComputerCraft.cfg. In builds prior to 1.6, turtles may store practically unlimited amounts of fuel. | |
Syntax | turtle.getFuelLimit() |
Returns | "unlimited" if fuel is disabled, otherwise the maximum fuel level. |
Part of | ComputerCraft |
API | turtle |