turtle.getFuelLevel() form turtle API
and the pastebin program
i am running computercraft 1.5
print(turtle.getFuelLevel)
displays nil?print(turtle.getFuelLevel)
if not http then print("HTTP seems to be disabled") end
image = pauntutils.loadImage(".gui")
paintutils.drawImage(image,1,1)
No thats not 'missing' the paintutils draw image. its that the loadImage doesn't seem to be loading the image from '.gui' file. since paintutils is saying `attempt to get length of nil` and the drawing gets the length of the table.and i uninstalled, and renstalled, and now i am missing paintutils draw Image. this is how i am using it;image = pauntutils.loadImage(".gui") paintutils.drawImage(image,1,1)
i get error, paintutils :92: attempt to get lenght of nil
Who are you telling that too? the OP does have it… in any case I can't remember which thread I stated it in, seems it wasn't this one but … function calls use the brackets, to access the function pointer you do not use the brackets. for example if turtle.getFuelLevel existed it would do thisTry turtle.getFuelLevel() with the brackets
print( turtle.getFuelLevel() ) -- this would print the fuel level
print( turtle.getFuelLevel ) -- this would print "function: 3454345" or some such random numbers
so doing 'turtle.getFuelLevel' without brackets can be a very useful tool to see if a function exists, since it would be nil. here is an example of a good usage of checking function pointers
if not term.isColor then
print "You are using a pre-CC1.4 Computer"
print "You cannot change colours"
elseif term.isColor() then
print "You are using an Advanced Computer"
print "You can change colours to any of the 16"
else
print "You are using a Normal Computer in CC1.4+"
print "You can change colours only between black and white"
end
fel = turtle.getFuelLevel()
if fel < 1 then
print("No Fuel")