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

[LUA][ERROR] "then" expected, although it was already defined

Started by leskat, 19 November 2012 - 04:02 AM
leskat #1
Posted 19 November 2012 - 05:02 AM
Hello

I was making a quarry turtle, and when I wanted to start it, it said a "then" on line 39 was expected, although I already had one. Did I do something wrong? Thanks a lot,
Leskat

http://pastebin.com/g6x3gu2u
billysback #2
Posted 19 November 2012 - 05:06 AM
On lines 107 to 112:

  while not (facing == homeFacing) do
                      right()
            end
                        moveDown()
                 end
          end
you have two too many "end"s, I think you mean:

  while not (facing == homeFacing) do
                      right()
                        moveDown()
          end

Thanks for tabbing, made it so much easier to debug.
leskat #3
Posted 19 November 2012 - 05:13 AM
On lines 107 to 112:

  while not (facing == homeFacing) do
					  right()
			end
						moveDown()
				 end
		  end
you have two too many "end"s, I think you mean:

  while not (facing == homeFacing) do
					  right()
						moveDown()
		  end

Thanks for tabbing, made it so much easier to debug.

Thanks you very much bilysback, I changed the code, but it still gave me the same error.

http://pastebin.com/ZuV4wur2
billysback #4
Posted 19 November 2012 - 05:14 AM
There is no open bracket "(" on line 39!
fixed:

             if (curLength == length) then
leskat #5
Posted 19 November 2012 - 05:27 AM
There is no open bracket "(" on line 39!
fixed:

			 if (curLength == length) then

Thank you very very much. That fixed the problem, I cleaned up the code and am working on getting it to work correctly. Thank you very much.