Moduł:No globals: Różnice pomiędzy wersjami
Z Czarnobyl Wiki
m (Changed protection level for "Module:No globals": Used in interface MediaWiki:Protectedpagetext ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))) |
m (1 wersja) |
||
| (Nie pokazano 3 wersji utworzonych przez 2 użytkowników) | |||
| Linia 2: | Linia 2: | ||
function mt.__index (t, k) | function mt.__index (t, k) | ||
if k ~= 'arg' then | if k ~= 'arg' then | ||
| − | error(' | + | -- perf optimization here and below: do not load Module:TNT unless there is an error |
| + | error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) | ||
end | end | ||
return nil | return nil | ||
| Linia 8: | Linia 9: | ||
function mt.__newindex(t, k, v) | function mt.__newindex(t, k, v) | ||
if k ~= 'arg' then | if k ~= 'arg' then | ||
| − | error(' | + | error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) |
end | end | ||
rawset(t, k, v) | rawset(t, k, v) | ||
end | end | ||
setmetatable(_G, mt) | setmetatable(_G, mt) | ||
Aktualna wersja na dzień 23:34, 22 cze 2019
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:No globals/opis
Błąd skryptu: Błąd Lua: Błąd wewnętrzny: Proces interpretera został zakończony z sygnałem "-129".
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
-- perf optimization here and below: do not load Module:TNT unless there is an error
error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)