require'debug'local a,error,rawset,rawget=debug.getinfo,error,rawset,rawget;local b={}local function c()local d=a(3,"S")return d and d.what or"C"end;function b.module(e,f,g)local h,i,j,k,l;if g then l=g.__global end;if type(f)=='table'then h=getmetatable(f)if h and rawget(h,'__declared')then return end else f={}end;if h==nil then h={}setmetatable(f,h)else i=h.__newindex;j=h.__index;k=type(j)end;h.__declared=g or{}h.__newindex=function(m,n,o)if i then i(m,n,o)if rawget(m,n)~=nil then return end end;if not h.__declared[n]then if l then local p=c()if p~="main"and p~="C"then error("assign to undeclared global '"..n.."'",2)end end;h.__declared[n]=true end;rawset(m,n,o)end;h.__index=function(m,n)if not h.__declared[n]and c()~="C"then if j then if k=="table"then local q=j[n]if q~=nil then return q end else local r=j(m,n)if r~=nil then return r end end end;local s="variable '"..n.."' is not declared"if e then s=s.." in '"..tostring(e).."'"end;error(s,2)end;return rawget(m,n)end;return f end;function b.make_all_strict(t)for u,o in pairs(t)do if type(o)=='table'and o~=t then b.module(u,o)end end end;function b.closed_module(f,e)local v={}f=f or{}local h=getmetatable(f)if not h then h={}setmetatable(f,h)end;h.__newindex=function(m,u,o)v[u]=o end;return b.module(e,v)end;if not rawget(_G,'PENLIGHT_NO_GLOBAL_STRICT')then b.module(nil,_G,{_PROMPT=true,_PROMPT2=true,__global=true})end;return b