Editing
Module:CountryData/doc
(section)
From Thetacola Wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== getalias === If used from wikicode, this function returns the value of a single field in a data template. The first parameter is the country or other entity whose data to return; the second is the name of the field. For example, <code>{{((}}#invoke:CountryData|getalias|France|flag alias{{))}}</code> → {{#invoke:CountryData|getalias|France|flag alias}}. The other parameters are {{para|variant}} to return a variant parameter value, with fallback to the main field value if the variant does not exist, and {{para|def}} for the fallback output if the wanted data template or field does not exist, the default for which is a literal "nil". Note: This is likely not quicker than wikicode-only alternatives such as {{tl|getalias}} and {{tl|getalias2}}, because it transcludes the data template from Lua and converts it to a Lua table using the above function, picks the wanted parameter name, and returns it to wikicode, whereas other templates perform two simple non-Lua transclusions to get, in most cases, the same result. The Lua version does have the advantage that using it with a non-existing country data template returns "nil" (or the value of {{para|def}}) rather than a redlink to the data template. See a comparison of the four at [[User:SiBr4/Flagg tests#Lua-based getalias|User:SiBr<sub>4</sub>/Flagg tests#Lua-based getalias]].
Summary:
Please note that all contributions to Thetacola Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information