Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Display Turtle Fuel Level and Percentage
- -- Function to get and display the Turtle's fuel information
- function displayFuelInfo()
- local fuelLevel = turtle.getFuelLevel()
- local maxFuelLevel = turtle.getFuelLimit()
- if fuelLevel == "unlimited" then
- print("Fuel level: Unlimited")
- else
- local fuelPercentage = (fuelLevel / maxFuelLevel) * 100
- print("Fuel level: " .. fuelLevel)
- print("Max fuel level: " .. maxFuelLevel)
- print("Fuel percentage: " .. string.format("%.2f", fuelPercentage) .. "%")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement