Module:No globals
Appearance
![]() | Do not edit. This page is maintained by an automated tool. All edits should be done at mediawiki.org. (translate this warning) Please help translate this page. |
local mt = getmetatable(_G) or {}
local oldIndex = mt.__index or function() return nil end
mt.__index = function(t, k)
if k ~= 'name' and k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return oldIndex(t, k)
end
local oldNewindex = mt.__newindex or rawset
function mt.__newindex(t, k, v)
if k ~= 'name' and k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
oldNewindex(t, k, v)
end
setmetatable(_G, mt)