Skip to content
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

Luacheck throws errors for additional assignment operators #8

Open
bedinotti opened this issue Mar 16, 2022 · 2 comments
Open

Luacheck throws errors for additional assignment operators #8

bedinotti opened this issue Mar 16, 2022 · 2 comments

Comments

@bedinotti
Copy link
Owner

Now that I've got luacheck working in VSCode and Nova, I've begun building some stuff with it. Unfortunately, while the new Additional assignment operators that the Playdate SDK adds to the language are useful, but luacheck doesn't know about them. Using them in your project results in false-negative errors -- errors reported by luacheck that aren't actually problems in your code.

Luacheck error in Nova

Luacheck error in vscode

Unfortunately, I think luacheck is right here -- for normal Lua code these are invalid operators. It just doesn't know about the PlaydateSDK's additions.


I've filed lunarmodules/luacheck#53 to see if they could make the operators understood by luacheck extensible in the .luacheckrc file. In the meantime, either:

  • Don't use these operators
  • Disable luacheck
  • Stare at these errors and laugh at your ability to be smarter than a computer when writing code.
@bdougherty
Copy link

FWIW, this can be solved in VSCode by adding "Lua.runtime.nonstandardSymbol": ["+=", "-=", "*=", "/="] to settings.json.

@ntippie
Copy link

ntippie commented Jan 2, 2023

I found some additional information here.

This seems to be sufficient for .luacheckrc:

std = "lua54+playdate"
operators = {"+=", "-=", "*=", "/="}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants