Template talk:Lua

Latest comment: 2 months ago by MSGJ in topic Request for two additions

Visual appearance edit

This template should get the standard look that is used for talk page templates (= orange/yellow? background).--Kozuch (talk) 17:24, 8 March 2013 (UTC)Reply

Done.--Kozuch (talk) 17:30, 8 March 2013 (UTC)Reply

Expansion edit

Note - I've started a discussion about possible expansion of this template, and the situations it is used in, at Wikipedia talk:Lua/Archive 1#Lua talk template. — Mr. Stradivarius ♪ talk ♪ 13:00, 10 July 2013 (UTC)Reply

Style edit

I see that Wnt has changed this to use "type=style", but I'm not sure that's such a good fit. According to Template:Ombox, "type=style" is for "Minor warnings and problems", and I don't think that "this template uses x module" really counts as a warning or a problem. I think "type=notice" is a better fit. — Mr. Stradivarius ♪ talk ♪ 21:43, 21 October 2013 (UTC)Reply

Well, I found myself doing a direct replacement of Template:Intricate with Template:Lua. The one warns that you have to know how to do template coding, the other warns you have to know how to do Lua. The idea seems very similar. If a novice comes to this template, they're going to think: where are the parameters being read? What does #invoke mean? What does Module mean? To me that's a minor warning/problem, isn't it? Wnt (talk) 22:14, 21 October 2013 (UTC)Reply
I'd say that a "you have to know Lua" warning would go better on the module /doc page, rather than the template page. I see this as more of an informational thing - "by the way, this template uses x Lua module". It's also an advertisement for interested people to get involved in Lua coding, where otherwise they may have no idea that the template uses anything other than wikitext. I can see that the typical Lua module code may require a warning similar to {{intricate}}, but I'm not sure that the #invoke syntax is complex enough to require an actual warning. (Though we should of course include any links necessary so that new users can find out what's going on.) If we made a template for module /doc pages instead, would you be satisfied with keeping this as a notice? — Mr. Stradivarius ♪ talk ♪ 01:52, 22 October 2013 (UTC)Reply
Well, the reason why it made sense to me to keep it on the template /doc page was that the template has been replaced with a syntax that isn't going to be familiar to many template writers. Suppose for a moment you've never seen the Scribunto extension and you open up your friendly template and find that 136k of stuff is gone, leaving behind an "#invoke:Module:x|some_mysterious_function|none of the arguments the template is accepting and processing". That's going to be really confusing. I don't think they should have to figure out to look up Module:x (which they might not recognize is a title, since Module: namespace will be unfamiliar to them) before getting the hint that this is Lua. True, there's no such warning if you use a bare #invoke in the article itself, but those are less likely to be replacing a previous template people are familiar with... Wnt (talk) 05:08, 22 October 2013 (UTC)Reply
While there appears little practical difference between "type = notice" and "type = style", on balance, I would choose "notice" rather than "style" for conformity with {{ombox}}'s doc since {{intricate}} is warning the editor that they are entering a mine field of extreme complexity and unpredictable behavior. Someone without reasonably good Lua skills could wreck a module, but I would take the view that the Lua code is a lot more structured and predictable than an intricate template, and does not warrant the kind of warning tone appropriate for the latter. If someone has weak Lua skills, they should be aware of that, while lots of editors have done a bit of template work and may be somewhat comfortable in that area—yet they need to warned when they putting their hands in a dangerous machine like an intricate template. Johnuniq (talk) 23:46, 11 November 2013 (UTC)Reply
Thanks for commenting here. I've switched back to using |type=notice for now, with no prejudice against rethinking if more people comment on this. — Mr. Stradivarius ♪ talk ♪ 23:38, 13 November 2013 (UTC)Reply

Do we need this as a box warning ? edit

I think it's nice that we track this kind of info, but I feel it's rather annoying to have it at the top in a big box. I'd much rather have it as a small right floating "toc":

Any thoughts ? alternatives ? —TheDJ (talkcontribs) 13:13, 30 December 2013 (UTC)Reply

I have similar thoughts about those Rating boxes btw. The template should emphasize documentation first, and technology last. That is also why we have the sandbox/testcases in the end box. Actually, by adding some params to {{documentation}} on the /doc, we could probably centralize handling of this information into {{documentation}}. — Preceding unsigned comment added by TheDJ (talkcontribs) 13:17, 30 December 2013‎ (UTC)Reply
I agree with this, actually. One of the reasons for making the Lua notice big and bold and at the top of documentation pages was to get more people involved in converting templates to Lua, but it hasn't really made huge numbers of people start writing Lua modules. The Google Code-in and WP:Lua/To do had a much bigger impact (although that's just my subjective personal opinion, of course). As long as the names of the modules and the link to the Lua page are there somewhere in a fairly visible place, I doubt it will make much of a difference in terms of getting template coder converts. (Probably much more effective would be creating a decent beginners' guide for Scribunto coding and overhauling the WP:Lua page.) So, all other things being equal, putting the documentation first makes sense on a documentation page. I also like the small right floating "toc" idea. I don't think integrating it with {{documentation}} is necessarily a good idea, though, as the parameters would get messy, and usually the {{documentation}} doesn't have any parameters. It would probably make more sense just to convert the existing {{lua}} template, as it is already in roughly the right place on most pages it is used on. — Mr. Stradivarius ♪ talk ♪ 14:47, 30 December 2013 (UTC)Reply
@TheDJ: I've converted this to a small mbox template, much like your suggestion above. Is that more acceptable? — Mr. Stradivarius ♪ talk ♪ 03:27, 29 April 2014 (UTC)Reply
I think this is a real improvement Mr. Stradivarius ! —TheDJ (talkcontribs) 08:19, 29 April 2014 (UTC)Reply

hlist rather than bulleted list? edit

As there doesn't seem to be many templates each using more than two or three Lua modules, here's a version of this template that uses an hlist rather than a b[ulleted] list. What do people think? Sardanaphalus (talk) 16:33, 1 September 2014 (UTC)Reply
PS It uses {{str right}} to strip the "Module:" prefix from the module names, but, as Module: is a namespace, I imagine there's a better method..?

@Sardanaphalus: mw.title.new can be used. If title object OBJ is created using mw.title.new( 'Module:Bananas', 'Module' ) or mw.title.new( 'Bananas', 'Module' ), OBJ.text gives "Bananas", while OBJ.prefixedText gives "Module:Bananas". -- ChongDae (talk) 10:04, 6 November 2015 (UTC)Reply

Improving idea edit

It should be usefull on module's subdoc too ; than depending of the namespace we would arg the corresponding basepagename. Youni Verciti (talk) 21:38, 23 March 2017 (UTC)Reply

Request for two additions edit

This template has an option to be used on module pages, which then changes the text shown to This module uses Lua:. I was wondering if it would be possible to add an option to list two things.

  • Module dependencies (modules the current module uses to function - basically anything used in a require() function) - the title would then be changed to: This module dependencies: (or something similar). The current title is just not that clear on the importance of that the modules listed there.
  • Template it implements - It should be made more clear what relationship a cetrain module has with a template. So that Module:Do something very specific will link to Template:Do something very specific in the same way as currently a template uses this template. The header should be something like This module implements:. --Gonnym (talk) 12:02, 5 October 2018 (UTC)Reply
@Gonnym I like both of these ideas. I also think it would be useful if we could specify the function of a module that is used by a template. — Martin (MSGJ · talk) 09:13, 16 February 2024 (UTC)Reply

Requested move 4 March 2019 edit

The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this section.

The result of the move request was: No consensus. (non-admin closure)  samee  converse  21:56, 20 March 2019 (UTC)Reply



Template:LuaTemplate:Lua banner – Template and module should have the same name {{3x|p}}ery (talk) 00:59, 4 March 2019 (UTC)--Relisted. – Ammarpad (talk) 07:14, 12 March 2019 (UTC)Reply

Alternately, move to Template:Uses Lua (and the module to Module:Uses Lua) for consistency with Template:Uses TemplateStyles. {{3x|p}}ery (talk) 05:31, 4 March 2019 (UTC)Reply
  • Support alternative proposal for WP:CONSISTENCY with {{Uses TemplateStyles}} and {{Uses Wikidata}}. --Gonnym (talk) 11:11, 12 March 2019 (UTC)Reply
  • Oppose I'm all for tidying up the back of the cupboard every now and then but insisting on renaming templates/modules for "consistency" is pointless. Renaming stuff as above would generate no benefit but would involve people fiddling to fix up links and documentation. There is nothing confusing about writing {{Lua|Module:Bananas}} to show that Module:Bananas is used. Someone who puzzles over that wikitext possibly is unaware of Scribunto/Lua/Module jargon and would be confused by any of the above titles. Johnuniq (talk) 00:03, 14 March 2019 (UTC)Reply

The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page or in a move review. No further edits should be made to this section.

Lua error when a template page does not exist yet edit

I found an issue while investigating Wikipedia:Help desk#Trying to make language template for Western Armenian (permanent link). Module:Lua banner tries to read or get information about the template page itself but if the page does not exist then it produces the error message "Lua error in Module:Lua_banner at line 90: attempt to index field 'edit' (a nil value)." This can apparently affect both preview before the page exists and the original save which creates the page. When the page is later purged it does exist at the time and there is no problem. Previewing {{Lua}} alone on a non-existing template page gives the same error. It's confusing to editors creating templates so it would be good to avoid. PrimeHunter (talk) 11:44, 15 September 2019 (UTC)Reply

@PrimeHunter: I just edited Module:Lua banner in a way that should fix the problem. Johnuniq (talk) 08:15, 16 September 2019 (UTC)Reply
Thanks. The error is now gone when I preview a non-existing template. PrimeHunter (talk) 11:03, 16 September 2019 (UTC)Reply

Template-protected edit request on 7 June 2020 edit

Please apply Special:Diff/956153638/961231921 to Module:Lua banner to show sandbox links. This is similar to Template:Uses TemplateStyles. See Template:Lua/testcases. —⁠andrybak (talk) 09:47, 7 June 2020 (UTC)Reply

  Done — Martin (MSGJ · talk) 18:53, 10 June 2020 (UTC)Reply

Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value). edit

Lua error on Template:Infobox book/wikidata: Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value). --Gonnym (talk) 12:28, 15 September 2020 (UTC)Reply

Gonnym, fixed: Special:Diff/978558819. The root cause is Module:Listify not existing. Perhaps Module:Lua banner could be updated to handle such cases better. —⁠andrybak (talk) 16:56, 15 September 2020 (UTC)Reply
Hello, hoping you maybe able to help me. I am having trouble with this same issue on the rw.wp. Was a solution ever found? example: https://rw.wikipedia.org/wiki/Module:Format_TemplateData BevoLJ (talk) 00:55, 19 May 2022 (UTC)Reply
@BevoLJ: have you resolved this issue? I am having the same here: https://lt.wikipedia.org/wiki/Module:Documentation Zygimantus (talk) 21:40, 8 February 2024 (UTC)Reply

Make the template work with 0 parameters by setting the module with the same name as default edit

The current {{lua}} template returns an error when used without any arguments. I want a default value of the first parameter to be set to the module with the same name as the template it is transcluded in. For example, if {{lua}} is placed on Template:Hatnote/doc, then it should behave like {{lua|hatnote}}. JsfasdF252 (talk) 16:44, 5 April 2021 (UTC)Reply

Template-protected edit request on 12 September 2021 edit

Module:Lua banner talk redirects here: Please replace:

boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=|link=]]'
with
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'

File moved at Commons: File:Lua-logo-nolabel.svgFile:Lua-Logo.svg - Christian75 (talk) 09:47, 12 September 2021 (UTC)Reply

  Done —⁠andrybak (talk) 17:49, 12 September 2021 (UTC)Reply