From d3f05daf6d3bb4861d8e014c2a85b7cf2ea240d1 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 3 Aug 2019 07:14:21 -0700 Subject: [PATCH] remove explicit_globals --- README.md | 4 ---- explicit_globals/corepatchlua.lua | 25 ------------------------- 2 files changed, 29 deletions(-) delete mode 100644 explicit_globals/corepatchlua.lua diff --git a/README.md b/README.md index 31f6c44..536422a 100644 --- a/README.md +++ b/README.md @@ -102,10 +102,6 @@ with all the appropriate character mappings. the code is Unlicensed, and i believe the font itself is public domain. -### explicit\_globals - -hmm, this probably shouldn't be here... - ### filter\_tutorial a single Python file that walks you through diff --git a/explicit_globals/corepatchlua.lua b/explicit_globals/corepatchlua.lua deleted file mode 100644 index b7f3bc9..0000000 --- a/explicit_globals/corepatchlua.lua +++ /dev/null @@ -1,25 +0,0 @@ -local mt = getmetatable(_G) -if mt == nil then - mt = {} - setmetatable(_G, mt) -end -mt.__declared = {} -function mt.__newindex(t, n, v) - if not mt.__declared[n] then - local info = debug.getinfo(2, "S") - if info and info.what ~= "main" and info.what ~= "C" then - error("cannot assign undeclared global '" .. tostring(n) .. "'", 2) - end - mt.__declared[n] = true - end - rawset(t, n, v) -end - -function mt.__index(t, n) - if not mt.__declared[n] then - local info = debug.getinfo(2, "S") - if info and info.what ~= "main" and info.what ~= "C" then - error("cannot use undeclared global '" .. tostring(n) .. "'", 2) - end - end -end \ No newline at end of file