模組:用戶:Cedric tsan cantonais/沙盒/No globals
呢個模組嘅解說可以喺模組:用戶:Cedric tsan cantonais/沙盒/No globals/doc度開
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error( "utilisation d'une variable globale, " .. tostring(k), 2 )
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error( "utilisation d'une variable globale, " .. tostring(k), 2 )
end
rawset(t, k, v)
end
setmetatable(_G, mt)