Module:No globals
Jump to navigation
Jump to search
Documentation for this module may be created at Module:No globals/doc
1 local mt = getmetatable(_G) or {}
2 function mt.__index (t, k)
3 if k ~= 'arg' then
4 error('Tried to read nil global ' .. tostring(k), 2)
5 end
6 return nil
7 end
8 function mt.__newindex(t, k, v)
9 if k ~= 'arg' then
10 error('Tried to write global ' .. tostring(k), 2)
11 end
12 rawset(t, k, v)
13 end
14 setmetatable(_G, mt)