Modul:No globals: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K
Modul:No globals (Quelltext anzeigen)
Version vom 19. Februar 2021, 02:52 Uhr
, 02:52, 19. Feb. 20214 revisions imported from w:en:Module:No_globals
StadtbahnBI>Minorax K (7 revisions imported from meta:Module:No_globals) |
StadtbahnBI>Magog the Ogre K (4 revisions imported from w:en:Module:No_globals) |
||
Zeile 2: | Zeile 2: | ||
function mt.__index (t, k) | function mt.__index (t, k) | ||
if k ~= 'arg' then | if k ~= 'arg' then | ||
error('Tried to read nil global ' .. tostring(k), 2) | |||
error | |||
end | end | ||
return nil | return nil | ||
Zeile 9: | Zeile 8: | ||
function mt.__newindex(t, k, v) | function mt.__newindex(t, k, v) | ||
if k ~= 'arg' then | if k ~= 'arg' then | ||
error | error('Tried to write global ' .. tostring(k), 2) | ||
end | end | ||
rawset(t, k, v) | rawset(t, k, v) | ||
end | end | ||
setmetatable(_G, mt) | setmetatable(_G, mt) |