LapizNinja

Error: Error: lua:1: attempt to index ? (a nil value)

Mar 8th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. function dig
  2.  
  3.     x = 0
  4.     y = 0
  5.    
  6.     turtle.refuel()
  7.     x = x+1
  8.     while x == 1 do
  9.         print("Refueled for the 1st time")
  10.     while x == 2 do
  11.         print("Refueled for the 2nd time")
  12.     while x == 3 do
  13.         print("Refueled for the 3rd time")
  14.     while x == x>3 do
  15.         print("Refueled for the "..x.."th time")
  16.     end
  17.    
  18.     while turtle.detect() do
  19.         turtle.dig()
  20.         y = y+1
  21.         turtle.forward()
  22.     end
  23.    
  24.     while turtle.detect() == false do
  25.         turtle.right()
  26.         turtle.forward()
  27.         turtle.right()
  28.     end
  29.    
  30.     print("Your turtle has refueled "..x.." times!")
  31.     print("Your turtle has dug "..y.." blocks!")
  32. end
  33.  
  34.  
  35.  
  36. This is the other way i tried it: (I still got the same error, which one should i use to make it more efficient)
  37.  
  38.  
  39. function dig
  40.  
  41.     x = 0
  42.     y = 0
  43.    
  44.     turtle.refuel()
  45.     x = x+1
  46.     if x == 1 then print("Refueled for the 1st time")
  47.     if x == 2 then print("Refueled for the 2nd time")
  48.     if x == 3 then print("Refueled for the 3rd time")
  49.     if x == x>3 then print("Refueled for the "..x.."th time")
  50.     end
  51.    
  52.     while turtle.detect() do
  53.         turtle.dig()
  54.         y = y+1
  55.         turtle.forward()
  56.     end
  57.    
  58.     while turtle.detect() == false do
  59.         turtle.right()
  60.         turtle.forward()
  61.         turtle.right()
  62.     end
  63.    
  64.     print("Your turtle has refueled "..x.." times!")
  65.     print("Your turtle has dug "..y.." blocks!")
  66. end
Advertisement
Add Comment
Please, Sign In to add comment