Modul:GetParameters/doc: razlika između inačica

Izvor: Hrvatska internetska enciklopedija
Prijeđi na navigaciju Prijeđi na pretraživanje
preuzeto s en.wikipedije
 
Nema sažetka uređivanja
 
Nije prikazana jedna međuinačica
Redak 1: Redak 1:
{{High use}}
{{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]]) -->
Redak 19: Redak 19:
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Lua metamodules]]
[[Kategorija:Lua metamoduli]]
}}</includeonly><noinclude>
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
[[Kategorija:Stranice dokumentacije modula]]
</noinclude>
</noinclude>

Posljednja izmjena od 2. svibanj 2025. u 02:15

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 <syntaxhighlight lang=lua inline>getParameters({"a", "b", "c"}, {"x", "y"})</syntaxhighlight> and <syntaxhighlight lang=lua inline>getParameters({x="a", y="b", z="c"}, {"x", "y"})</syntaxhighlight> would both give back <syntaxhighlight lang=lua inline>{x="a", y="b"}</syntaxhighlight>.

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