luacheck icon indicating copy to clipboard operation
luacheck copied to clipboard

luacheck does not warn about accessing nonexistent members of table

Open crabdancing opened this issue 5 years ago • 3 comments

I create code with the following contents:

local some_namespace = {}
some_namespace.nonexistent_function()
print(some_namespace.whyyyyy)

Result:

$ luacheck badcode.lua
Checking badcode.lua                              OK

Total: 0 warnings / 0 errors in 1 file

crabdancing avatar Oct 30 '20 01:10 crabdancing

Please read #198

Seadragon91 avatar Oct 30 '20 04:10 Seadragon91

Aww that's really sad :c I hope you find someone who can help take care of this repo.

crabdancing avatar Oct 31 '20 02:10 crabdancing

I don't think this is something luacheck is ever going to be able to check. You would have to execute the code in order to know for sure what was or wasn't in a Lua table. There is no way to know with any confidence from just lexing the language as you show. Also Lua has ways of handling this where calling non-existing methods can actually create/load them etc.

If you still feel this is something that needs more feedback please open a new issue on the new official repository here. In the mean time please consider closing this issue to help tidy up as there is nobody with permissions to do so—only issue authors can close their own.

alerque avatar Oct 07 '21 17:10 alerque