-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first line in Lua script starting with # causes error "expected statement near '#'" #211
Comments
I found that in lexer.lua, line 690, there IS a test for a shebang line, but it requires the line to begin with #! , where the Lua interpreter just requires the line to begin with # . |
please read #198 |
I think this may be a case where Lua is wrong and we can ignore what it might have allowed. As far as I know the so called hashbang / shebang must actually be both characters to valid for the use case of specifying a script interpreter. Are there really any other valid use case that shouldn't throw a warning? In any event if you still think this is an issue we should address, please open a new issue on the new official repository. As the previous commenter noted the maintainer of this one passed away and we have no way to resolve issues here any more. It would be appreciated if you close this to help us track what is dealt with and (if applicable) open a new issue on the active repository. Thanks! |
We have a different use case, where the first line contains a digital signature of the rest of the Lua script, which is hidden from the Lua interpreter by the #-character. |
I think a bit more orthodox way to do this would be to use a Lua comment, somewhat like -- signature: <hash>
print("rest of script") Overloading the idea of a hashbang for this seems like an edge case that probably shouldn't be allowed. That Lua handles it is probably a mistake or lazy parsing shortcut and you might not want to rely on it. Of course it is open source and you can do what you like, but as a the current maintainer I'm not convinced this is something we should accommodate in the regular releases. |
retrospectively, the comment would have been the better choice, but I can't change it any more. |
Lua allows at the top of a Lua script a special line starting with # to support the shebang mechanism of Unix shells.
The Lua interpreter skips such a line.
I could not find an option to let luacheck do the same
The text was updated successfully, but these errors were encountered: