Re: typo checks considered mandatory (was Re: Is "scripting" trulyLua's future?)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: typo checks considered mandatory (was Re: Is "scripting" trulyLua's future?)
- From: Veli-Pekka Tätilä <vtatila@...>
- Date: 2008年9月12日 22:47:08 +0300
Alexander Gladysh wrote:
> 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
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:
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