Jump to content




Attempt to Call Nil Error


  • You cannot reply to this topic
8 replies to this topic

#1 Icyboom15

  • New Members
  • 7 posts

Posted 22 December 2012 - 04:48 AM

Keep getting an "Attempt to Call Nil" error in line 6. Nothing I seem to do fixes it, though..

g = 0

print("Welcome to MineHall 2.0")

print("How long would you like the tunnel:")

len = tonumber(read())

turtle.select(1)

turtle.refuel()

while g < len do

turtle.dig()

turtle.forward()

turtle.digUp()

turtle.digDown()

g = g+1

end

print("Finished mining.")

Any and all help is appreciated. :)

#2 anonimo182

  • Members
  • 252 posts
  • LocationIn the universe

Posted 22 December 2012 - 05:05 AM

You need to select the quantity to refuel in turtle.refuel(), like: turtle.refuel(1) will refuel with 1 unit from selected slot

#3 Icyboom15

  • New Members
  • 7 posts

Posted 22 December 2012 - 05:13 AM

But if left blank, it refuels with the entire stack, no?

EDIT: Tried with (1) in the spot, still a nil value.

#4 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 22 December 2012 - 05:20 AM

View PostIcyboom15, on 22 December 2012 - 05:13 AM, said:

But if left blank, it refuels with the entire stack, no?

EDIT: Tried with (1) in the spot, still a nil value.

Yes.

What version of CC are you using, and have you maybe changed the settings for turtles to NOT use fuel.

#5 Icyboom15

  • New Members
  • 7 posts

Posted 22 December 2012 - 05:25 AM

I am using 1.3, as it is on a tekkit server, and although i am looking up how to, I have not altered the settings.

EDIT: Oh wait.. You don't even need fuel in 1.3, right? Or is that in both 1.3 and 1.4?

#6 OmegaVest

  • Members
  • 436 posts

Posted 22 December 2012 - 05:27 AM

You don't need fuel in 1.3.

#7 Icyboom15

  • New Members
  • 7 posts

Posted 22 December 2012 - 05:28 AM

Wow. What an idiot.. Thanks guys! Hahaha..

#8 OmegaVest

  • Members
  • 436 posts

Posted 22 December 2012 - 05:31 AM

Also, a good way to test whether a function exists is to fulfill its parameters (such as putting fuel in the selected slot, in this case), and then using it in an if statement. Most functions return true if they fire.

#9 ChunLing

  • Members
  • 2,027 posts

Posted 22 December 2012 - 12:23 PM

Just check if turtle.refuel then or print(type(turtle.refuel)).

But yeah, no refuel function in 1.3.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users