Wikipedia:Lua requests

From Wikipedia, the free encyclopedia
Jump to: navigation, search
  WP:Lua
Project
  WT:Lua
Project talk
  Modules
 
  Help
 
  To do
 
  Requests
 
  Resources
en: m: mw: external
 
Shortcuts:

Lua scripts on Wikipedia are similar to templates but useful for performing more complex tasks for which templates are too complex or slow. Common examples include numeric computations, string manipulation and parsing, and decision trees. You can use this page to request help from Lua developers in writing a Lua module for a specific task on Wikipedia or another Wikimedia Foundation project. Both debugging help and full implementation are available.

To start a request, just make a new section below and describe what you need. You may wish to first check Special:PrefixIndex/Module: to see if you can find a suitable existing script.

It may help developers to provide examples of where the task is likely to be useful within Wikipedia. If the proposal would replace or improve upon existing templates, please note which ones.

My getArgs disappears the first unnamed 1= argument[edit]

I am researching module:Arguments to get learn it. Now, when I echo my input arguments (getArgs), there is this:

  1. {{#invoke:User:DePiep/cc|echo|foo|bar}} → #1: foo, #2: bar Green tickY
  2. {{#invoke:User:DePiep/cc|echo|1=foo|bar}} → #1: bar Red XN

module:User:DePiep/cc

(More code or proof needed?) In test 2 the first parameter has is not seen. Any hints?. -DePiep (talk) 22:56, 10 November 2014 (UTC)

That's nothing to do with Lua, it's just the way {{...}} works. I believe the text is parsed left-to-right although I don't recall seeing that in any docs. When "1=foo" is encountered, it sets the first unnamed argument to "foo". When "bar" is encountered, it sets the first unnamed argument to "bar" (which replaces "foo"). After that, the result is passed to #invoke, which calls the module. All templates and module invokes do that. Johnuniq (talk) 23:09, 10 November 2014 (UTC)
Wow, you're right. It goes wrong in full wikicode too. I have never met this in old wikicode age (knowingly ...). -DePiep (talk) 23:25, 10 November 2014 (UTC)
And there is a plenty of such incorrect usages, which are tracked by the Category:Pages using duplicate arguments in template calls. Paweł Ziemian (talk) 21:41, 11 November 2014 (UTC)