Jump to content

Module:Yesno/doc/en: Difference between revisions

Content deleted Content added
FuzzyBot (talk | contribs)
Updating to match new version of source page
 
FuzzyBot (talk | contribs)
Updating to match new version of source page
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<languages/>
<noinclude><!--
<noinclude><!--
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!--
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!--
--><languages /><!--
--><!--
--></noinclude>{{#switch:
--></noinclude>{{#switch:
| =
| =
<includeonly>{{Languages|Module:Yesno/doc}}</includeonly>
<includeonly></includeonly>
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{high-risk}}
{{high-risk}}
Line 16: Line 17:
The module also accepts other Lua structures as input, i.e. booleans, numbers, tables, and functions.
The module also accepts other Lua structures as input, i.e. booleans, numbers, tables, and functions.
If it is passed input that it does not recognise as boolean or <code>nil</code>, it is possible to specify a default value to return.
If it is passed input that it does not recognise as boolean or <code>nil</code>, it is possible to specify a default value to return.

== Module Quality ==
== Module Quality ==

{{ModuleQuality}}
{{ModuleQuality}}

== Syntax ==
== Syntax ==

<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
yesno(value, default)
yesno(value, default)
Line 26: Line 31:
Boolean input or boolean-style input (see below) always evaluates to either <code>true</code> or <code>false</code>, and <code>nil</code> always evaluates to <code>nil</code>.
Boolean input or boolean-style input (see below) always evaluates to either <code>true</code> or <code>false</code>, and <code>nil</code> always evaluates to <code>nil</code>.
Other values evaluate to <code>default</code>.
Other values evaluate to <code>default</code>.

== Usage ==
== Usage ==

First, load the module. Note that it can only be loaded from other Lua modules, not from normal wiki pages.
First, load the module. Note that it can only be loaded from other Lua modules, not from normal wiki pages.
For normal wiki pages you can use {{tlx|yesno}} instead.
For normal wiki pages you can use {{tlx|yesno}} instead.
Line 110: Line 117:
<includeonly>{{Sandbox other||
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
<!-- Categories below this line; interwikis at Wikidata -->

[[Category:Modules]]
[[Category:Modules]]
}}</includeonly><noinclude>
}}</includeonly><noinclude>
[[Category:Module documentation pages{{#translation:}}]]
[[Category:Module documentation pages{{#translation:}}{{#translation:}}]]

</noinclude>
</noinclude>
| #default=
| #default=