<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AParameterCount%2Fdoc</id>
	<title>Module:ParameterCount/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AParameterCount%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:ParameterCount/doc&amp;action=history"/>
	<updated>2026-10-31T22:24:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://elite.mistflux.co.uk/w/index.php?title=Module:ParameterCount/doc&amp;diff=112986&amp;oldid=prev</id>
		<title>Wikipedia&gt;Chrisahn: /* See also */ Remove mention of Module:Params, it&#039;s being deleted</title>
		<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Module:ParameterCount/doc&amp;diff=112986&amp;oldid=prev"/>
		<updated>2026-07-02T16:13:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;See also: &lt;/span&gt; Remove mention of &lt;a href=&quot;/w/index.php?title=Module:Params&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Params (page does not exist)&quot;&gt;Module:Params&lt;/a&gt;, it&amp;#039;s being deleted&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{High-use}}&lt;br /&gt;
This module counts the number of parameters that are passed to a template. For example, you might put the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|all}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; inside the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; template. If you then use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;&lt;br /&gt;
{{my template&lt;br /&gt;
| one&lt;br /&gt;
| two&lt;br /&gt;
| three&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|all}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; code inside the template will give the result &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This module can be configured to count all parameters, or specific parameters defined by a template author. This module is only useful in templates. It should not be used on non-template pages.&lt;br /&gt;
&lt;br /&gt;
The module has two functions available, &amp;lt;code&amp;gt;all&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== all ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;all&amp;lt;/code&amp;gt; function is used to count all parameters specified when using a template, regardless of whether or not they are used in the template itself.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:ParameterCount|all}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|all}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; was added to the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; template, the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template|1|2|foo=bar}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; would make ParameterCount produce &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== main ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; function is used to count parameters with specific names. There are two ways of specifying parameters: by name, and using Lua patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;By name&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:ParameterCount|main|1|2|3|abc|def}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To specify a parameter by name, add the parameter name as a positional parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;By pattern&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:ParameterCount|main|pattern1=^param%d+$|pattern2=^abc}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To specify parameters by Lua Ustring pattern, add the pattern to {{para|pattern1}}, {{para|pattern2}} etc. For information on constructing Lua patterns, see the [http://lua-users.org/wiki/PatternsTutorial Lua Users&amp;#039; Wiki pattern tutorial], as well as the Lua reference manual sections on [[mw:Extension:Scribunto/Lua_reference_manual#Patterns|Lua patterns]] and [[mw:Extension:Scribunto/Lua_reference_manual#Ustring_patterns|Ustring patterns]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|main|1|2|abc}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; was added to the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; template, the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template|1|2|abc=some value|other=some other value}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; would make ParameterCount produce &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|main|pattern1=^param%d+$}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; was added to the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; template, the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template|param1=a value|param2=another value|param5=yet another value}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; would make ParameterCount produce &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Checking for blanks ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:ParameterCount|all|checkblanks=no}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:ParameterCount|main|checkblanks=no}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, the module doesn&amp;#039;t count parameters whose values contain only whitespace, e.g. {{para|abc|&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;}}. If you wish to count all parameters, regardless of their value, use {{para|checkblanks|no}}. This works with both the &amp;lt;code&amp;gt;all&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; functions.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:ParameterCount|all|checkblanks=no}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; was added to the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; template, the code &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{my example template|1|2|foo=bar|baz=}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; would make ParameterCount produce &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox | |&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Template metamodules]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Chrisahn</name></author>
	</entry>
</feed>