lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2 July 2014 22:19, David Demelier <demelier.david@gmail.com> wrote:
Thanks,

I have no idea what I'm doing wrong

~/test $ luac52 -l test.lua | lua52 FindGlobals52.lua test.lua

~/test $ cat test.lua
print(failed)
~/test $ head -n 5 FindGlobals52.lua

--[[

globals.lua (FindGlobals), a useful script to find global variable access in
.lua files, placed in the public domain by Mikk in 2009.

Cheers,
David.

By default it ignores global gets (GETGLOBAL/GETTABUP) in the file scope, only showing global sets (SETGLOBAL/SETTABUP) in the file scope and both gets/sets in functions.

I'm not the author of the original script, but he might of chosen this behaviour as the default because it's quite common to make local aliases of global functions at the top of each file and thus you probably wouldn't care about global gets in the file scope.

To show global gets in the file scope, add this line to your test file:

-- GETGLOBALFILE ON

This and the other options are described in the comment at the top of the script.

Regards,
Choonster