模块:No globals

Cquote>Great Brightstar2014年10月5日 (日) 13:58的版本 (中文化)

可在模块:No globals/doc创建此模块的帮助文档

local mt = getmetatable(_G) or {}
function mt.__index (t, k)
	if k ~= 'arg' then
		error('读取该非全域数据出错:' .. tostring(k), 2)
	end
	return nil
end
function mt.__newindex(t, k, v)
	if k ~= 'arg' then
		error('写入该全域数据出错:' .. tostring(k), 2)
	end
	rawset(t, k, v)
end
setmetatable(_G, mt)