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

[Solved]missing then statement?

Started by shakey2, 21 April 2013 - 12:45 PM
shakey2 #1
Posted 21 April 2013 - 02:45 PM
Ok it's been a long time since I used Lua (learning ruby right now :P/>) so I'm rusty but can anyone tell me what's wrong with this script? I'm sure its something stupidly obvious I just can't figure it out.


for i=1,64 do
  turtle.placeUp()
  for j=1,5 do
	turtle.dig()
	turtle.forward()
	x = turtle.detectDown()
	if x = false then
	  turtle.select(2)
	  turtle.placeDown()
	  turtle.select(1)
	end
	turtle.digUp()
  end
end

The problem is at line 7 btw
Kingdaro #2
Posted 21 April 2013 - 02:54 PM
On that line, use a double equal sign "==" instead of just one.
if x == false then

An alternative:
if not x then
shakey2 #3
Posted 21 April 2013 - 02:57 PM
Thanks, works now.