Prints all Lua globals being declared (written) or accessed (read) by a supplied lua script.
With Luarocks installed, run
luarocks install lua-globalsOtherwise, download lua-globals.lua, and its dependency, argparse, and place them into the directory for Lua libraries or your working directory so that you can call lua-globals from shell.
Additionally, do the same for inspect if you plan to use the -d | --debug flag.
lua-globals -m RW your_script.lualua-globals [-h] [-l {51,52,53,54}] [-m {R,W,RW}] [-d] ([<input>] ... | [-i])
input
Input file. If no provided, reads from STDIN
-h,--help
Show help message and exit.-i,--read-from-stdin
Read from stdin.-l {51,52,53,54},
--lua-version {51,52,53,54}
Script Lua version target (default: 54)-m {R,W,RW},
--mode {R,W,RW}
Globals reporting mode.
Ris for read access,Wis for write access,RWif for all globals access. (default:RW)-d,
--debug
Enables debug output.
This is a fork of Egor Scriptunoff's amazing show_globals
GitHub Gist organized as a repo and published to Luarocks package manager
with extended cli support, thus all the credit goes to Egor Scriptunoff.