Module:No globals/doc: Difference between revisions

From WIDEVERSE Wiki
Jump to navigation Jump to search
m (1 revision imported)
 
Mediawiki>ExE Boss
Line 1: Line 1:
{{high-risk|11,040,000+ pages, which is {{#expr:(1104688900/{{NUMBEROFPAGES:R}}) round 0}}% of all}}
<noinclude><!--
{{module rating|protected}}
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!--
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
--><languages /><!--
--></noinclude>{{#switch:<translate></translate>
| =
<includeonly>{{Languages|Module:No globals/doc}}</includeonly>
{{Shared Template Warning|Module:No globals|No globals}}
{{Module rating|release}}
{{Module rating|protected}}
<translate>
== Usage == <!--T:1-->
</translate>
<translate><!--T:2--> Include this module at the top of your code.</translate>
<translate><!--T:3--> An error will be raised any time your code tries to read or write to a non-local (undeclared) variable.</translate>


This module causes an error if any nil global is read or if any global is written to, with the exception of <var>arg</var>. To use, add <syntaxhighlight lang="lua" inline>require('Module:No globals')</syntaxhighlight> to the top of the module using it. The <var>arg</var> variable is excluded because it is necessary for Scribunto's [[mw:Extension:Scribunto/Lua reference manual#require|require]] function to work properly. (See the Scribunto source code [https://phabricator.wikimedia.org/diffusion/ELUA/browse/master/engines/LuaCommon/lualib/package.lua;f768b950134a6a32c094be92c8c139a11f8880df$101 here].)
<translate>
 
== Tests == <!--T:4-->
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
</translate>
<!-- Categories go here and interwikis go in Wikidata. -->
{{ModuleQuality}}
[[Category:Lua metamodules]]
<includeonly>{{Sandbox other||
}}</includeonly>
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Modules{{#translation:}}]]
}}</includeonly><noinclude>
[[Category:Module documentation pages{{#translation:}}]]
</noinclude>
| #default=
  {{#invoke:Template translation|renderTranslatedTemplate|template=Module:No globals/doc|noshift=1|uselang={{int:lang}}}}
}}

Revision as of 11:29, 17 August 2021

<languages />

warning Lua error in Module:TNT at line 158: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Shared Template Warning.tab.Lua error in Module:TNT at line 158: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Shared Template Warning.tab.
Lua error in Module:TNT at line 158: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Shared Template Warning.tab.

Usage

Include this module at the top of your code. An error will be raised any time your code tries to read or write to a non-local (undeclared) variable.

Tests

Lua error in Module:TNT at line 158: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/ModuleQuality.tab.
Module:No globals success: 1, error: 0, skipped: 0
Module:No globals/sandbox success: 0, error: 1, skipped: 0