Revision as of 15:38, 23 April 2014 by CfJackmcbarn(talk)(←Created page with 'local mt = getmetatable(_G) or {} local oldIndex = mt.__index or function() return nil end mt.__index = function(t, k) if k ~= 'name' and k ~= 'arg' then erro...')
This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing.
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
This module causes an error if any nil global is read or if any global is written to, with the exception of arg. To use, add require('Module:No globals') to the top of the module using it. The arg variable is excluded because it is necessary for Scribunto's require function to work properly. (See the Scribunto source code here.)
localmt=getmetatable(_G)or{}localoldIndex=mt.__indexorfunction()returnnilendmt.__index=function(t,k)ifk~='name'andk~='arg'thenerror('Tried to read nil global '..tostring(k),2)endreturnoldIndex(t,k)endlocaloldNewindex=mt.__newindexorrawsetfunctionmt.__newindex(t,k,v)ifk~='name'andk~='arg'thenerror('Tried to write global '..tostring(k),2)endoldNewindex(t,k,v)endsetmetatable(_G,mt)