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

Lua error Feller Turtle expected name for loop

Started by Nattas, 10 October 2015 - 10:19 PM
Nattas #1
Posted 11 October 2015 - 12:19 AM
So im using this code

http://pastebin.com/W2YkrW3K


And for line 142, Im getting the error bios; 339 : [string "programName"] : 142 '<name>' expected and i dont know whats wrong with it, I looked through the code and what i put in the game, And im confused, Why is it causing this and how to i fix it
KingofGamesYami #2
Posted 11 October 2015 - 01:18 AM
The program works (somewhat) fine for me, try deleting it and re-downloading.

**note: I didn't use a turtle, so the turtle stuff didn't work, but I got beyond the point where bios errors would be generated**
Bomb Bloke #3
Posted 11 October 2015 - 01:36 AM
Indeed, that code doesn't produce that error. Double check that that's in the script file you're actually running.

The error itself is often caused by attempting to enter in a pre-defined Lua keyword as a variable name. For example, you can't simply use "return" as the name of a variable, because Lua has that word reserved for other usage.
Edited on 10 October 2015 - 11:37 PM
Nattas #4
Posted 11 October 2015 - 03:19 PM
Is there a way to identify which line is producing line 142 to be the error? or can you guys do it for me =P IM asking this because i couldnt use pastebin on the server im in and couldnt ctrl c ctrl v so i just manually typed the whole thing
Lyqyd #5
Posted 11 October 2015 - 05:44 PM
If you can't get the code out, you'll need to verify that it matches exactly, character by character. You can't go any faster than one character at a time or you risk accidentally fixing problems in the process of trying to copy it out.
Dustmuz #6
Posted 11 October 2015 - 09:23 PM
the error is that in the for loop you are write 1 = 1, 16 , 4 do..

you cant have the 1 BEFORE the =

i've done this a few times.. just give it a letter instead :)/> that will solve that problem at least
HPWebcamAble #7
Posted 11 October 2015 - 09:49 PM
the error is that in the for loop you are write 1 = 1, 16 , 4 do..

Nice catch, that's likely it. On the pastebin, it's a lowercase L, but I'd bet it was copied as the number 1
Dustmuz #8
Posted 11 October 2015 - 10:22 PM
i've made that mistake some times, and i've helped a few that made exactly the same..

if you name a for loop with a number, it will throw the error he's getting :)/>
and lower case L and 1 looks "exactly" the same, so it can be tricky to spot :)/>
Nattas #9
Posted 13 October 2015 - 05:30 AM
Thank you so much for saving me hours of my life trying to figure out whats wrong, Now i can work on my other stuff <3