Jump to content




[Error/Bug] [Turtle] Expected Number


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

#1 Emma

  • Members
  • 216 posts
  • Locationtmpim

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


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 December 2012 - 11:46 AM

You declare currsel, but use crrsel in that line, which will be nil.

#3 Emma

  • Members
  • 216 posts
  • Locationtmpim

Posted 09 December 2012 - 11:46 AM

View PostLyqyd, on 09 December 2012 - 11:46 AM, said:

You declare currsel, but use crrsel in that line, which will be nil.

Whoops, typo! Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users