Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module talk:Arguments
(section)
Add languages
Page contents not supported in other languages.
Add topic
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
Add topic
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
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!
== Using ipairs == I have not seriously used Module:Arguments so now that I'm looking at how it is used in [[Module:Team appearances list]], I am puzzled about the default options and <code>ipairs</code>. What happens if a module does the following? <syntaxhighlight lang="lua"> local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) -- where frame is from a template invoke for i, v in ipairs(args) do print(i, v) end </syntaxhighlight> I gather that works as expected with something like <code><nowiki>{{example|one|two|three}}</nowiki></code> (and it would trim any leading/trailing whitespace from each parameter). However, it would only process "one" in <code><nowiki>{{example|one||three}}</nowiki></code> because the blank second parameter would be converted to nil, and that would terminate ipairs. Does that mean that anything using Module:Arguments with a variable number of numeric arguments must use something like <code>compressSparseArray</code> from [[Module:TableTools]] (or set options to not trim/remove parameters)? If that is true, I would have thought it would be mentioned in the documentation here. Did an early version of Module:Arguments default to removing blank parameters so ipairs processes each provided numeric parameter (that's what I thought happened)? [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 03:25, 18 November 2016 (UTC) :{{re|Johnuniq}} Have you found a solution for this problem? β [[User:UnladenSwallow|UnladenSwallow]] ([[User talk:UnladenSwallow|talk]]) 01:58, 15 May 2020 (UTC) ::{{re|UnladenSwallow}} I haven't looked for a solution because I don't like obscure layers. Module:Arguments appears to be very efficient although it appears to do quite a lot of work, yet it seems unnecessary overhead to me. I've never needed the module and I don't know if the above is a problem now. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 03:38, 15 May 2020 (UTC)
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem: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)