Module:No globals: Difference between revisions
Jump to navigation
Jump to search
classes>Louis Alarcon m (1 revision imported) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 20:43, 4 September 2022
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)