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

[Error/Bug] [Turtle] Expected Number

Started by Emma, 09 December 2012 - 10:45 AM
Emma #1
Posted 09 December 2012 - 11:45 AM
Hi, i am fairly new to computercraft and I developing some code but it keeps giving me Expected Number for line 10 can you help?


local tArgs = { ... }
currsel=1
if #tArgs == 2 then
  height = tonumber(tArgs[1])
  length = tonumber(tArgs[2])
  for i=1,4 do
    for j=1,(length-1) do
	  for k=1,height do
	    turtle.up()
	    if turtle.getItemCount(crrsel) ~= 0 then
		  turtle.placeDown()
	    else
		  print("If no more blocks, please add more! Unless you like me spazzing out!")
		  local testmore = false
		  while testmore ~= true do
		    if currsel == 16 then
			  currsel = 1
		    else
			  currsel = currsel + 1
		    end
		    if turtle.getItemCount(tonumber(crrsel)) ~= 0 then
			  local testmore = true
		    end
		  end
	    end
	  end
	  turtle.forward()
	  while not turtle.detectDown() do
	    turtle.down()
	  end
    end
    turtle.turnRight()
  end
else
print("Usage: walls <height> <length>")
sleep(2)
end
Lyqyd #2
Posted 09 December 2012 - 11:46 AM
You declare currsel, but use crrsel in that line, which will be nil.
Emma #3
Posted 09 December 2012 - 11:46 AM
You declare currsel, but use crrsel in that line, which will be nil.

Whoops, typo! Thanks!