Anonymous
Not logged in
English
Talk
Contributions
Create account
Log in
Objectshowpedia
Search
Editing
Module:Arguments/doc
(section)
From Objectshowpedia
Namespaces
Module
Discussion
More
More
Page actions
Read
Edit source
History
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!
=== Trimming and removing blanks === Blank arguments often trip up coders new to converting MediaWiki templates to Lua. In template syntax, blank strings and strings consisting only of whitespace are considered false. However, in Lua, blank strings and strings consisting of whitespace are considered true. This means that if you don't pay attention to such arguments when you write your Lua modules, you might treat something as true that should actually be treated as false. To avoid this, by default this module removes all blank arguments. Similarly, whitespace can cause problems when dealing with positional arguments. Although whitespace is trimmed for named arguments coming from #invoke, it is preserved for positional arguments. Most of the time this additional whitespace is not desired, so this module trims it off by default. However, sometimes you want to use blank arguments as input, and sometimes you want to keep additional whitespace. This can be necessary to convert some templates exactly as they were written. If you want to do this, you can set the <code>trim</code> and <code>removeBlanks</code> arguments to <code>false</code>. <syntaxhighlight lang="lua"> local args = getArgs(frame, { trim = false, removeBlanks = false }) </syntaxhighlight>
Summary:
Please note that all contributions to Objectshowpedia are considered to be released under the Creative Commons Attribution-ShareAlike (see
Objectshowpedia:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, 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.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Landing page
Recent changes
Random page
Help about MediaWiki
Discord server
Multiverse
Objects
Places
Items
Teams
Events
Real world
Object shows
Camps
Episodes
Staff
Music
Games
Basics
Over the years
Pre-2013
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs