Module:Pn/doc: Difference between revisions
Appearance
Content deleted Content added
→Examples: add examples of wrapper template |
Accessing named parameters |
||
Line 6: | Line 6: | ||
A wrapper template may be used to simplify usage. |
A wrapper template may be used to simplify usage. |
||
For accessing both named and unnamed parameters, see {{mfl|params|value_of}}. |
|||
== Examples == |
== Examples == |
||
Line 21: | Line 23: | ||
* <code><nowiki>{{wdib|ps=1|P8011|qid=Q84055514}}</nowiki></code> → {{wdib|ps=1|P8011|qid=Q84055514}} |
* <code><nowiki>{{wdib|ps=1|P8011|qid=Q84055514}}</nowiki></code> → {{wdib|ps=1|P8011|qid=Q84055514}} |
||
* <code><nowiki>{{wdib|ps=1|P8011|qid=Q84055514|list=p-1}}</nowiki></code> → {{wdib|ps=1|P8011|qid=Q84055514|list=p-1}} |
* <code><nowiki>{{wdib|ps=1|P8011|qid=Q84055514|list=p-1}}</nowiki></code> → {{wdib|ps=1|P8011|qid=Q84055514|list=p-1}} |
||
== See also == |
|||
* {{mfl|params|value_of}} |
Latest revision as of 21:42, 9 February 2024
The module returns one value from its list of unnamed parameters.
The named parameter |idx=
is the index of the parameter that is to be returned.
Negative indices count backward from the end of the list.
A wrapper template may be used to simplify usage.
For accessing both named and unnamed parameters, see {{#invoke:params|value_of}}.
Examples
[edit]{{#invoke:Pn |getVal | idx=1}}
→{{#invoke:Pn |getVal | idx= | a | b | c | d | e | f }}
→ a{{#invoke:Pn |getVal | idx=0 | a | b | c | d | e | f }}
→{{#invoke:Pn |getVal | idx=1 | a | b | c | d | e | f }}
→ a{{#invoke:Pn |getVal | idx=2 | a | b | c | d | e | f }}
→ b{{#invoke:Pn |getVal | idx=-1 | a | b | c | d | e | f }}
→ f{{#invoke:Pn |getVal | idx=99 | a | b | c | d | e | f }}
→
Using a wrapper template, {{P-1}}:
{{p-1 | a | b | c | d | e | f }}
→ f{{wdib|ps=1|P8011|qid=Q84055514}}
→{{wdib|ps=1|P8011|qid=Q84055514|list=p-1}}
→