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 -- perf optimization here and below: do not load Module:TNT unless there is an error
5 error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2)
6 end
7 return nil
8 end
9 function mt.__newindex(t, k, v)
10 if k ~= 'arg' then
11 error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2)
12 end
13 rawset(t, k, v)
14 end
15 setmetatable(_G, mt)