"Closed bracket expected" even though there is one

SpinSlash165

speeeeeeeen
This has been plaguing me for the last several months.

Sometimes after I've made a change to a Lua script, the game spits this in my face when I try to load it:
Code:
WARNING: [directory]|LUA_SHOT:33: ')' expected (to close '(' at line 10) near 'end'

I have NEVER changed the position of the final bracket. It's always been this:
Code:
end)

Please help!
 
Unfortunately there's nothing anyone can do to help without the full code. If you never changed the position of the first and final parentheses, then some change in between must have caused the problem.
 
When you see an error message like this, you want to focus not on the line it throws the error at, but on this part:

Code:
(to close '(' at line 10)


That indicates where the unclosed parenthesis started. You want to start looking there to see if you missed a closing parenthesis at the end of a statement. (This can easily happen with multiple nested sets, such as "FunctionCall(blah, (blah+blah))".)


The line the error itself is thrown at is the last point where that statement could have possibly been closed, as the "end" can't be in that statement without an appropriate opener for it to close.
 
Thank you for your help! Turns out yes, it was an error in the code itself - I forgot to pull a few lines back after I removed another. I'll keep this in mind for the future!
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top