---- strict.lua-- checks uses of undeclared global variables-- All global variables must be 'declared' through a regular assignment-- (even assigning nil will do) in a main chunk before being used-- anywhere or assigned to inside a function.--localmt=getmetatable(_G)ifmt==nilthenmt={}setmetatable(_G,mt)endmt.__declared={}mt.__newindex=function(t,n,v)ifnotmt.__declared[n]thenlocalw=debug.getinfo(2,"S").whatifw~="main"andw~="C"thenerror("assign to undeclared variable '"..n.."'",2)endmt.__declared[n]=trueendrawset(t,n,v)endmt.__index=function(t,n)ifnotmt.__declared[n]anddebug.getinfo(2,"S").what~="C"thenerror("variable '"..n.."' is not declared",2)endreturnrawget(t,n)end