Idi na sadržaj

Modul:No globals

S Wikipedije, slobodne enciklopedije

Dokumentaciju za ovaj modul možete napraviti na straniciModul:No globals/dok

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