[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: typo checks considered mandatory (was Re: Is "scripting" trulyLua's future?)
- From: Veli-Pekka Tätilä <vtatila@...>
- Date: Fri, 12 Sep 2008 22:47:08 +0300
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.
Have you tried Metalint? (I advise to get some recent version from Git.)
See also this page:
luac -l -p test.lua |findstr /r /i "[gs]etglobal"
It produces output like:
2  SETGLOBAL 0 -1 ; foo
6  GETGLOBAL 0 -4 ; prit
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: