This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
zdb's profile picture

cc1.4.1 getFuelLevel() [error] Attempt to index ?

Started by zdb, 04 August 2012 - 04:18 AM
zdb #1
Posted 04 August 2012 - 06:18 AM
computercraft 1.41, minecraft 1.25

turtle.getFuelLevel() returns an error for almost any program.
————————————–
baked-in programs like
/rom/programs/turtle/go
do work correctly.

However,
If I copy go to /
and try to run it
then the go copy fails as well.



example:
—————————
#> edit test

if turtle.getFuelLevel() < 10 then
print("low fuel")
end

#> test
test:1: attempt to index ? (a nil value)
Luanub #2
Posted 04 August 2012 - 06:30 AM
Hmmm that should work. Are you sure everything is installed properly?

Test to make sure that turtle.getFuelLevel() is returning a value by doing..


local a = turtle.getFuelLevel()
print(a)

You could also try to do this, although it shouldn't matter.

local a = tonumber(turtle.getFuelLevel())
if a < 10 then
print("Low Fuel")
end
zdb #3
Posted 04 August 2012 - 06:53 AM
Thanks, but both versions fail on the turtle.getFuelLevel()

Very strange that turtle.compareTo(), turtle.suck(), turtle.attack() all work fine.
(new for cc1.41)
Only turtle.getFuelLevel() fails.

Thanks for trying.

I'll try the usual. Check &amp; re-download forge and CC. Restart in a new minecraft directory.
Anyone know how to identify the exact release of CC1.41 I'm using?
Luanub #4
Posted 04 August 2012 - 06:59 AM
I'm at work, when I get home I'll see if I cant duplicate this.