Mont d’an endalc’had

Modulenn:No globals

Eus Wikipedia
Stumm eus an 28 Eos 2022 da 07:24 gant Huñvreüs (kaozeal | degasadennoù) (13 adweladenn enporzhiet eus commons:Module:No_globals)
(diforc'h) ← Stumm kent | Gwelet ar stumm red (diforc'h) | Stumm war-lerc'h → (diforc'h)

Documentation for this module may be created at Modulenn:No globals/doc

local mt = getmetatable(_G) or {}
function mt.__index (t, k)
	if k ~= 'arg' then
		error('Tried to read nil global ' .. tostring(k), 2)
	end
	return nil
end
function mt.__newindex(t, k, v)
	if k ~= 'arg' then
		error('Tried to write global ' .. tostring(k), 2)
	end
	rawset(t, k, v)
end
setmetatable(_G, mt)