|
Alexander Gladysh wrote:
Thanks for the help. I read the relevant section in the excellent Lua users Wiki and found that Luac can do the hardest part of the job. They gave a unix example but something like the following works on Windows:> Humans make mistakes; pretending otherwise is just ignoring reality. I > don't want a computer to second- guess my design decisions; but when it > comes to spelling, I *need* help.> I invented a strict.lua but it only works at runtime, not compile time. > <snip>Have you tried Metalint? (I advise to get some recent version from Git.) http://lua-users.org/lists/lua-l/2008-04/msg00082.html See also this page: http://lua-users.org/wiki/DetectingUndefinedVariables
luac -l -p test.lua |findstr /r /i "[gs]etglobal" It produces output like: 2 [1] SETGLOBAL 0 -1 ; foo 6 [3] GETGLOBAL 0 -4 ; prit etc...The idea being parse, don't compile code, list disassembled lines and filter only those that involve sets or gets to global variables, if I got it right. The neat thing is that I don't need to download any extras to use this method. Now I only need a whitelist of allowed globals including built-ins and other modules (via reflection), and maybe a small Lua script around that for proper filtering. All that should be easily doable. So thanks for indirectly pointing me to one simple solution that just might be good enough for my needs.
-- With kind regards Veli-Pekka Tätilä Accessibility, Apps and Coding plus Synths and Music: http://vtatila.kapsi.fi