-- Penlight 1.11.0-1 | /lua/pl/strict.lua | https://github.com/lunarmodules/Penlight | License: MIT | Minified using https://www.npmjs.com/package/luamin/v/1.0.4
-- Copyright (C) 2009-2016 Steve Donovan, David Manura.
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
