Turtle asks me to end a for loop that I already ended

Started by krissum, Dec 04, 2021, 06:51 AM

Previous topic - Next topic

krissum

https://pastebin.com/16tBTTVc

I'm new to Lua, and generally a beginner to programming in general, so I'm sure this is the simplest mistake imaginable but I cannot for the life of me figure out what I did wrong.

I'm running this code into an Advanced Mining Turtle with the default turtle GPS API from the wiki preinstalled.

The error message produced by the code is:
.temp:169: "end" expected (to close "for" at line 133) near <eof>

If I add an arbitrary extra "end" to line 169, it just runs the code without doing anything. I'm sure there's many more typos and bugs for me to straighten out with the rest of the program, as I've already been doing that for quite a while (I wrote the whole thing outside of minecraft) but this one in particular is blocking me from continuing. I'd appreciate some help from someone more experienced to tell me what I'm doing wrong or to even maybe explain why I was wrong if you'd like to.

Thanks!

SquidDev

On line 150, you have "else if turtle.detectDown() then" - that needs to be elseif. Really do wish Lua had a way to warn about that.
GitHub | CC:Tweaked: A ComputerCraft fork | Plethora: A peripheral mod

Lupus590

Quote from: SquidDev on Dec 04, 2021, 11:34 AMReally do wish Lua had a way to warn about that.

It might if you add ;'s to line endings, I've seen other error messages improve by adding them.