Modul:superstrict
Bu modul uchun Modul:superstrict/doc nomli hujjat sahifasini yaratishingiz mumkin
local error = error
local new_G = {}
new_G.__index = new_G
setmetatable(_G, new_G)
for k, v in next, _G do
new_G[k] = v
_G[k] = nil
end
function new_G:__index(k)
-- `arg` and `_G` are used by `require`.
if k == "arg" or k == "_G" then
return new_G[k]
elseif new_G[k] then
error("variable '" .. k .. "' is a global", 2)
end
error("variable '" .. k .. "' is not declared", 2)
end
function new_G:__newindex(k, v)
if k ~= "arg" then
error("assign to undeclared variable '" .. k .. "'", 2)
end
new_G[k] = v
end