function canRefuel()
return turtle.getItemCount(16) > 0
end
function fuelUp()
local oldSlot = turtle.getSelectedSlot()
if (canRefuel()) then
turtle.select(16)
turtle.refuel(1)
turtle.select(oldSlot)
else
print('Error: no fuel')
end
end
Comments