> The simplest starting point, implementable with stock tools, that comes to my (5.1) mind is putting that chunk of code into a separate file and running a global reference detector on it (luac -p|grep [GS]ETGLOBAL). Now, Lua 5.2+ has no such ops... For a tool, see http://lua-users.org/lists/lua-l/2012-12/msg00397.html and the thread starting at http://lua-users.org/lists/lua-l/2013-01/msg00470.html