1*21d3294cSantirez-- reads luac listings and reports global variable usage 2*21d3294cSantirez-- lines where a global is written to are marked with "*" 3*21d3294cSantirez-- typical usage: luac -p -l file.lua | lua globals.lua | sort | lua table.lua 4*21d3294cSantirez 5*21d3294cSantirezwhile 1 do 6*21d3294cSantirez local s=io.read() 7*21d3294cSantirez if s==nil then break end 8*21d3294cSantirez local ok,_,l,op,g=string.find(s,"%[%-?(%d*)%]%s*([GS])ETGLOBAL.-;%s+(.*)$") 9*21d3294cSantirez if ok then 10*21d3294cSantirez if op=="S" then op="*" else op="" end 11*21d3294cSantirez io.write(g,"\t",l,op,"\n") 12*21d3294cSantirez end 13*21d3294cSantirezend 14