bedinotti / playlate

A template for Playdate games
MIT License
63 stars 9 forks source link

Luacheck throws errors for additional assignment operators #8

Open bedinotti opened 2 years ago

bedinotti commented 2 years ago

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 https://github.com/lunarmodules/luacheck/issues/53 to see if they could make the operators understood by luacheck extensible in the .luacheckrc file. In the meantime, either:

bdougherty commented 2 years ago

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

ntippie commented 1 year ago

I found some additional information here.

This seems to be sufficient for .luacheckrc:

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