Jump to content

Module:No globals

Gikan sa Bikol Sentral na Wikipedia, an talingkas na ensiklopedya
Pagbabago puon kaitong 19:33, 14 Mayo 2015 ni Lam-ang (urulay | ambag) (copied from Module:No globals/606781024)
(iba) ← Mas luma | Presenteng pagbabago (iba) | Mas bago → (iba)

Lua error in Module:Documentation at line 144: message: type error in message cfg.container (string expected, got nil).

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)