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

Expected Number? I gave it one

Started by TechedZombie, 19 April 2015 - 02:50 PM
TechedZombie #1
Posted 19 April 2015 - 04:50 PM
I have a function and it doesn't seem to be working.


function getSlot()
  for i = 1, 16 do

	cnt = turtle.getItemCount(i)
  
	if cnt > 3 then
	  slot = i
	  break
	end

  end

  turtle.select(slot)

end

I get Expected Number on turtle.select()
KingofGamesYami #2
Posted 19 April 2015 - 05:11 PM
Does a slot have 4 or more items in it? If not, it will never define slot.
HPWebcamAble #3
Posted 19 April 2015 - 05:27 PM
Try adding this


function getSlot()

  local slot = turtle.getSelectedSlot()

  --# The rest of the function

end
TechedZombie #4
Posted 19 April 2015 - 05:55 PM
Never mind figured out

Does a slot have 4 or more items in it? If not, it will never define slot.

Thanks it was giving me nil otherwise this helped