Module:No globals: திருத்தங்களுக்கு இடையிலான வேறுபாடு
Jump to navigation
Jump to search
"local mt = getmetatable(_G) or {} function mt.__index (t, k) if k..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது |
சி en:Module:No_globals இலிருந்து ஒரு திருத்தம் |
||
(வேறுபாடு ஏதுமில்லை)
| |||
16:11, 12 சனவரி 2016 இல் நிலவும் திருத்தம்
| This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
வார்ப்புரு:Shared Template Warning
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)