What does this error mean, also thank you if you responded. It may seem so simple to some of you, but I just got into scripting, so yeah.
Expected <eof>, got end | This means..?
1 answer
"Expected , got [somthing or other]" means that you probably have an extra "end" somewhere in your code, which is ending the function before you probably want it to.
function lol()
if true == false then
print("This is impossible :P")
end --1
end --2
print("If you see this, I'm fixed!")
end --3
In this example, the function lol() ends at "end" number 2, instead of "end" number 3 like we want it to. The problem is "end" number 1, which might of been left over from some previous code. To fix the error, go through your code and make sure each of your if, for, while, etc... statements has only 1 matching "end" statement. Keeping code correctly indented really helps with this.
Do this:
function lol()
if true == true then
print("Always true")
for i = 1, 10 do
print(i)
end
elseif true == false then
print("IMPOSSIBLE!")
end
end
Not this:
function lol()
if true == true then
print("Always true")
for i = 1, 10 do
print(i)
end
elseif true == false then
print("IMPOSSIBLE!")
end
end
Good code organization habits will really pay off in the long run, when you have hundreds of lines all blending together. Good luck!
If I've solved your problem, be sure to mark my answer correct :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
also stands for end of file, so if you see it means the error is near the end
Yeah, not just "somewhere" in your code.
Not necessarily. I've had it before where an extra end in an if statement near the middle of my code completely messed up the ordering of the code and gave me this error. What's important is not just getting rid of the error, it's preserving the code structure. That's why I put "somewhere" instead of "near the end", as the actual problem isn't always at the end of code.
Those functions would never work. You never called them
They functions are an illustration. They do nothing. The point was simply to explain what causes the EOF errors.