diff options
author | David Seifert <soap@gentoo.org> | 2012-02-17 09:00:00 +0000 |
---|---|---|
committer | David Seifert <soap@gentoo.org> | 2012-02-17 09:00:00 +0000 |
commit | 008fb1e761e20336d42a19132292183e00909181 (patch) | |
tree | a28e0246f0b0404a5c066b8f2a888db45e30fc44 /test/globals.lua | |
download | lua-patches-008fb1e761e20336d42a19132292183e00909181.tar.gz lua-patches-008fb1e761e20336d42a19132292183e00909181.tar.bz2 lua-patches-008fb1e761e20336d42a19132292183e00909181.zip |
Add upstream 5.1.5
Signed-off-by: David Seifert <soap@gentoo.org>
Diffstat (limited to 'test/globals.lua')
-rw-r--r-- | test/globals.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/globals.lua b/test/globals.lua new file mode 100644 index 0000000..d4c20e1 --- /dev/null +++ b/test/globals.lua @@ -0,0 +1,13 @@ +-- reads luac listings and reports global variable usage +-- lines where a global is written to are marked with "*" +-- typical usage: luac -p -l file.lua | lua globals.lua | sort | lua table.lua + +while 1 do + local s=io.read() + if s==nil then break end + local ok,_,l,op,g=string.find(s,"%[%-?(%d*)%]%s*([GS])ETGLOBAL.-;%s+(.*)$") + if ok then + if op=="S" then op="*" else op="" end + io.write(g,"\t",l,op,"\n") + end +end |