Jump to content
Wikipedia The Free Encyclopedia

Module:GetParameters/doc: Difference between revisions

From Wikipedia, the free encyclopedia

Aidan9382 (talk | contribs)

3 user groups
Extended confirmed users, Page movers, Template editors
16,174 edits
undo
Content deleted Content added
Line 1: Line 1:
{{High use}}
{{Module rating |b<!-- Values: pre-alpha • alpha • beta • release • protected -- If a rating not needed/relevant, delete this template call -->}}
{{Module rating |b<!-- Values: pre-alpha • alpha • beta • release • protected -- If a rating not needed/relevant, delete this template call -->}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->

Revision as of 12:29, 10 May 2024

Warning This Lua module is used on approximately 2,020,000 pages, or roughly 3% of all pages .
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected.

Usage

getParameters

Takes 2 required arguments, frame_args and arg_list. Parses a frame's arguments, returning either the provided named arguments in arg_list if found or the positional parameters instead if not. This is designed to work around the stripping of values that takes place for defined parameters which could be important.

As an example, the calls getParameters({"a","b","c"},{"x","y"}) and getParameters({x="a",y="b",z="c"},{"x","y"}) would both give back {x="a",y="b"}.

getBoolean

Takes 1 required argument boolean_str. Turns the input into a true/false boolean value based on the input. Will error if given anything other than a string or boolean value.

defined

To be invoked from inside a template instead of a module. Determines if a certain parameter is defined in the parent frame's arguments.

See also


AltStyle によって変換されたページ (->オリジナル) /