This page is an archive. Do not edit the contents of this page. Please direct any additional comments to the current main page. |
Could a module be written to take a list of dates, link them, and indicate the next coming date? This would be useful for templates like Template:Lunar eclipses which need to be constantly updated by editors. Thanks — Martin ( MSGJ · talk) 12:36, 25 March 2015 (UTC)
|item1=
and |date1=
, sorts them by date, adds a highlighter and outputs them as an unordered list.
MSGJ: will that do the job? —
Mr. Stradivarius
♪ talk ♪ 04:52, 26 March 2015 (UTC)
See Template:Convert, especially the documentation as it shows.
It has a big "Translate this template into Swahili" messagebox in top. But the editors who visit this page are not translators. So I'd like to have this box miniaturized into a side-box (just like the {{ Lua}} box already in there). Upstream, it has the Ombox and module:Message box. Where to set which switch? (at the moment, I'm not in to learning that; so just do it please. I'll see). - DePiep ( talk) 21:47, 25 March 2015 (UTC)
|small=yes
to {{
transwiki guide}} to output a small template. —
Mr. Stradivarius
♪ talk ♪ 06:43, 26 March 2015 (UTC)
Hi, can anyone give me a quick greatest-hits of visualization modules that have been built on-wiki here? I'm aware of Module:Chart for starters. Res Mar 20:47, 28 March 2015 (UTC)
I wrote a module that one of it's functions returns text formatted using a template. When invoking the function the template doesn't get expanded.
What am I doing wrong?
Thanks, אלישיב ליפא ( talk) 08:44, 31 March 2015 (UTC)
A few links:
A link to the module: https://he.wikisource.org/wiki/%D7%99%D7%97%D7%99%D7%93%D7%94:%D7%A4%D7%A8%D7%A9%D7%9F_%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A
An example is (currently) in the sandbox of he.wikisource
Hi. I'm using a Lua module to create some functionality, and the call to the module seems to break lines. I have no Idea why this is happening, and I hope someone can help me.
Example for a break: https://he.wikisource.org/wiki/%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A_%D7%97%D7%95%D7%A9%D7%9F_%D7%9E%D7%A9%D7%A4%D7%98_%D7%A4%D7%95
אלישיב ליפא ( talk) 20:18, 31 March 2015 (UTC)
I have a page User:Ahmetyal/sandbox/2 which I wan't to move from a template to a module, because I have reached the limit with locations. -- Ahmetyal ( talk) 09:28, 19 April 2015 (UTC)
Is it possible to add another Archive title here (line 92)? So, By default (without adding any prefix) module will show Archive title 1 or Archive title 2 or both If archive title exist. I need this option for bengali wikipedia because on bn.wiki some user use their archive title as 'User:name/Songkolon 1' & some user use their archive title as 'User:name/Songrohoshala 1'. Here i tried to do this. Feel free to edit or make any changes here or here. Please help, Thanks -- Aftabuzzaman ( talk) 00:16, 26 April 2015 (UTC)
|prefix=whatever
when invoking the module (that replaces "Archive" with "whatever"). They would probably want to also use |prefixspace=yes
which adds a space to the end of "whatever". If wanted, prefixspace can be omitted, and prefix can be set like this: |prefix=whatever 
.
Johnuniq (
talk) 11:27, 5 May 2015 (UTC)Hi, I am from Bhojpuri wikipedia (bhwiki). I am designing our community portal and I need a template which can enlist and show all the pages in a category on the page where it is inserted. is it possible to get somthing like this?-- Satyam Mishra --talk-- 18:58, 25 May 2015 (UTC)
{{#categorytree:Geography|hideroot|mode=pages|namespaces=0}}
See Template talk:Val § Behaviour on substitution. – Wbm1058 ( talk) 15:12, 2 June 2015 (UTC)
in one of the recent software updates, we received a new extension: mw:Extension:Graph. this can and should replace everythig we do, for instance, in Module:Chart: it can do barbraphs, pie charts, and so much more.
the problem with this extension is somewhat similar to the problem with mw:Extension:Timeline, which was the previous charting tool (it still exists, but is obsolete): it does not use syntax which is familiar and convenient to wikipedia editors.
now, some time ago i wrote Module:Chart, which plots pie charts and bar graphs. the implementation is disgusting, if i say so myself, because of the very limited support vanilla html provides for charting: the bars are generated by "div" elements with absolute positioning, and the pie chart is based on some obscure features of the way html renders borders (the exploitation itself is ingenious, IMO, and is taken from Template:Pie chart).
i kinda like the syntax used by Module:Chart - i think it lets the editors provide the meaningful data, and hides from them all the mundane details. i asked on this page, several times, for suggestions to make the syntax even better, but there was not much response.
the request here is simple: create a module that will receive parameters in the same syntax used by Module:Chart, but instead of using obscure and perverse methods to draw the graph, will use then new Graph tag.
as a second round, we should use this extension to support more chart types: line chart, scatter chart, horizontal bar graph, and if someone will gets really ambitious, maybe 3-d bar chart.
as a side, i'll mention that the graph extension can do more than just charts - this should be left as an exercise for other modules.
i believe the extension supports all the charts that can be found here: here, but i cant guarantee this is the case.
peace - קיפודנחש (aka kipod) ( talk) 17:00, 8 May 2015 (UTC)
frame:extensionTag
to get the graph to render.
Anomie
⚔ 23:29, 8 May 2015 (UTC)
Hi קיפודנחש (aka kipod), Anomie, Resident Mario, have a look at this by Mps:
I want to write a new template that will be invoked as follows:
It should display in the article as follows:
IT\ICCU\MIL\0205279 should be a clickable external link coded as follows:
My problem...I don't know how to parse the template's parameter to get "MIL" and "0205279", how to concatenate "MIL" and "0205279" to produce "MIL0205279", and how to stick "MIL0205279" into the middle of the external link's definition. I'm guessing Lua.
If you would please help me this first time, citing relevant Wiki pages along the way, I'll be able to handle it myself in the future. Thanks. Knife-in-the-drawer ( talk) 16:13, 28 June 2015 (UTC)
..
, Lua's concatenation operator. ('ab' .. 'cd'
will give you the string "abcd".) The sandbox is simpler, but it isn't as elegant if something goes wrong - try putting a bad code into both of them to see what I mean. And please ask if you have any questions about the code. —
Mr. Stradivarius
♪ talk ♪ 00:45, 29 June 2015 (UTC)
I've made a feature request for
module:Infobox here:
Infobox, header-when-not-empty. Basically, it adds a parameter |headern-cond=
that only shows when its section contains data (consider how it has to be encoded today).
There is some good support, it's 'only' needs to be encoded in Lua. Anyone interested? - DePiep ( talk) 18:51, 28 June 2015 (UTC)
I'm taking first baby steps in Lua. What I want to do I could do in minutes in perl with regular expressions, but even the online Lua help materials aren't much help, because Scribunto's requirements for how it does thing are so rigid. I've barely gotten it to return (sometimes) a valid result for the first part of this I'm testing (just numerals, and without need to <nowiki>...</nowiki>
the input). I haven't figure out how to use boolean operators with Lua string manipulation, as in "look for this OR that".
-
, .
and numerals.My immediate need for this is converting sloppy CSS-related input like -10px
, 2.2em;
or even style="font-size: 70% ;"
to -10
, 2.2
, or 70
, respectively, and return that number. My assumption is that I should be able to wrap the input in <nowiki>...</nowiki>
, in case someone inputs something daft like |style=font-size: 70%
, with a |
symbol, but that's not essential. The #1 use would be conversion of percentile values in particular, like 70%
, to bare numbers, like 70
. Need a variant function that divides the result by two and rounds to two decimal places, but I'm sure I can add that myself after I see how the main part works.
.
followed by a numeral; or-
or the proper negative/minus glyph −
followed by either of:
.
followed by a numeral.
, unless one was matched earlier;.
is found, or any other non-numeral is found);^
or e
, and x
or ×
or *
when found in a context that indicates an exponent (23.5x10^8
), and a few other such cases (e.g. characters used to indicate a truncated long/endless decimal)Any help on the basic request at the top would be much appreciated, the rest is more of a "what if...?" proposition. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 22:33, 17 July 2015 (UTC)
function ExtractNumbers(str)
local tResult = {}
str:gsub( "%-?[%d%.]+", function(x) table.insert(tResult, x) end)
return tResult
end
myvar = ExtractNumbers('style="font-size: 70% ;"')
myvar = ExtractNumbers('style="font-size: 70% ;"')[1
font-size: 10%
will come out as -10%
. Your use of a table is probably more robust, too; I just did enough to get the result I immediately needed for a specific application, conversion of "70%" to "70", and the ability to halve it. Anyone should feel free to tinker further. —
SMcCandlish ☺
☏
¢ ≽ʌⱷ҅ᴥⱷʌ≼ 14:51, 18 July 2015 (UTC)
onlyNumber = (string.gsub(theString, "[^%d%.-]", ""))
to onlyNumber = (string.match(theString, "%-?[%d%.]+"))
would help with the problem with font-size: 10%
. It would also just retun the first set of numbers rather than all numbers in theString. --
WOSlinker (
talk) 16:36, 18 July 2015 (UTC)
Please see Template talk:Multi-section link#Development request. Short version: Need variant that links each sectional name, not just the last one. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 18:55, 23 July 2015 (UTC)
After going through these requests, I found and completed a recent one( here) that I've wanted to create since lua was announced in wikia:
Anyway, in wikia modules are listed [1] so feel free to import any modules you find useful (I've shamelessly imported many from here anyway :). Unlike mediawiki's scribunto, wikia has global modules that can be accessed from any other wikia, however they haven't really become popular yet (almost nobody adds modules to dev.wikia). So maybe those interested can import modules from there to here or here to there or even collaborate on some modules.
Wikia's scribunto doesn't have all libraries available in mediawiki though, so some scripts that work here may not work there.
Announcement,module and github merge:
Dessamator 197.218.89.127 ( talk) 14:49, 15 August 2015 (UTC)
The source code of this template is verbose, redundant, and difficult to read. It should be re-written as a Lua module so that it can be maintained more easily. Jarble ( talk) 01:27, 19 June 2015 (UTC)
{{helper| {{{prefix|}}} | {{{suffix|}}} | {{{noredlinks|}}} | Angola }} {{helper| {{{prefix|}}} | {{{suffix|}}} | {{{noredlinks|}}} | Denmark }} ... (repeat for all countries)
|GE=Foo of Georgia
);|article=
parameter to either enforce or prevent the definite article (using the current "prefix but no suffix" rule if unspecified);Module:User:Doc Taxon/Hello and user:Doc Taxon/Hello
Hi, I am looking for help creating a loop by Lua. I want the script to output the hello line 5 times, but I get back this: "Lua error in Module:User:Doc_Taxon/Hello at line 10: attempt to concatenate global 'u' (a table value)." What can I do? Thank you very much Doc Taxon ( talk) 15:07, 12 October 2015 (UTC)
local name = frame.args1
if not name then
name = 'World'
end
local name = frame.args1 or 'World'
if not a then
do_something()
end
a or do_something()
if a then
do_something()
end
a and do_something()
false
and nil
are falsy in Lua. There is no distinction between null
and undefined
as there is in JavaScript, and in Lua the spelling is nil
, never null
. —
Mr. Stradivarius
♪ talk ♪ 10:12, 16 October 2015 (UTC)I'm requesting Module:Location map/data/Pyongyang (cf. Module:Location map/data/Istanbul). The map image can be found at File:Map Pyongyang.jpg. The relevant country level location map template is at Template:Location map North Korea. For reference, the requested module already exists on the French ( fr:Modèle:Géolocalisation/Pyongyang) and Polish ( pl:Szablon:Mapa dane Pjongjang) language Wikipedias. Finnusertop ( talk | guestbook | contribs) 12:51, 15 October 2015 (UTC)
Previously, I
pinged some users to bring attention to this discussion. Their attention was no longer needed after the reply below. Sorry for the inconvenience.
Right now, Commons has
a
collection
of
war
maps which are frequently updated using data from collaboration which happens on the English Wikipedia for each map. A problem exists where the date these war map images were last updated needs to be distributed to articles which use the maps, so that users can know how up-to-date they are ("current as of 10 Nov 2015" or something). This problem is currently being solved using
this module which might as well be a template and has to be manually updated. Is it possible, using Lua, to automate the retrieval of this date, or possibly generalise it to any file so that future maps can also have this convention applied to them? If it isn't possible using lua, I'm strongly considering writing a bot which does this automatically. Thanks in advance. --
BurritoBazooka (
talk) 02:07, 10 November 2015 (UTC)
{{REVISIONTIMESTAMP: File:filename}}
, but that only works for files on the local wiki, and it also includes edits to the file description page as well as new uploads. If that works for you, you can call it from Lua using frame:callParserFunction('REVISIONTIMESTAMP', 'File:Filename')
. Best —
Mr. Stradivarius
♪ talk ♪ 02:46, 10 November 2015 (UTC)
I'm curious to know what the p stands for? Is it program? public? -- Psychoslave ( talk) 12:50, 25 November 2015 (UTC)
The current {{ Zodiac date}} gives wrong answers for 2015. The approach of finding an empirical formula to predict dates of astronomical events is both not feasible and original research. I'm thinking of creating a Lua program that would have 12 tables, one for each sign of the zodiac. Each table would have a list of years from 2015 through 2050 (which is as far as my reliable source will predict). The index of the table would be the year, and the result from the table would be a day of the year (e.g "Feb. 18". Each table would have 35 rows.
I haven't programmed in Lua before, but I've programmed in many other languages from System/370 assembler to C#, so I'm not worried about figuring out the language. But I am concerned that having such a large template might be detrimental to the articles that include the template. Am I on the right track? — Preceding unsigned comment added by Jc3s5h ( talk • contribs) 14:30, 29 November 2015 (UTC)
Is it possible to scan the contents of articles for specific text strings (actually template) based on a list of articles in a category and its sub-categories? I would like to make these table numbers dynamic. -- Traveler100 ( talk) 18:03, 4 January 2016 (UTC)
If anyone has some spare time then perhaps do a code review of Module:Timing? And the doc page needs a spell check too! I believe the precision in the produced numbers are about as they get, but there could be other ideas out there. Note that this solution are for those that develop code on their own, without a debugger running in a controlled environment. Note also that the test cases are written for another library, and that it does not work as of this writing. Hopefully it will work later on. Jeblad ( talk) 18:03, 18 January 2016 (UTC)
for
loop with no purpose?math.pow
but it is the same as v^2
.#timing == 0
even if I thought it couldn't happen.time[i]
on the lhs.p.combine
is part of p
? Why not just a local function, if module users don't need to access it? Similar for other functions.local function dummy()
" as I don't think a global is needed.p.combine
was an access point for testing, could be put inline insteadfunction dummy()
is used for baseline timing, and usually you will not test local functionsdummy = 'hello'
would wipe out the dummy function. By "pretty rare" I meant that it would be rare to need to test the timing of a module. I understand that you don't use Module:Timing in another module, but nearly all modules run very fast and don't need to be optimized. I would think any modules that are too slow are just trying to do too much work, and only a very small number of modules would benefit from measuring the time taken by various functions. As mentioned, I had one of those rare exceptions a few days ago where I found a bottleneck that was removed by using a different method. However, I was doing a ridiculously large number of tests just from interest to see how long it would take.
Johnuniq (
talk) 10:24, 19 January 2016 (UTC)
dummy = 'hello'
would have some implications. I haven't checked timing for local lookup, but usually that is much faster in other languages. Often by a factor ten or more. I can put the dummy function in the exported lib, that would be close enough.=require 'Module:Timing'(p.hello)
. In the timing module, timing for the following would then be obtained:
self.runner(dummy, ...)
self.runner(func, ...)
This page is an archive. Do not edit the contents of this page. Please direct any additional comments to the current main page. |
Could a module be written to take a list of dates, link them, and indicate the next coming date? This would be useful for templates like Template:Lunar eclipses which need to be constantly updated by editors. Thanks — Martin ( MSGJ · talk) 12:36, 25 March 2015 (UTC)
|item1=
and |date1=
, sorts them by date, adds a highlighter and outputs them as an unordered list.
MSGJ: will that do the job? —
Mr. Stradivarius
♪ talk ♪ 04:52, 26 March 2015 (UTC)
See Template:Convert, especially the documentation as it shows.
It has a big "Translate this template into Swahili" messagebox in top. But the editors who visit this page are not translators. So I'd like to have this box miniaturized into a side-box (just like the {{ Lua}} box already in there). Upstream, it has the Ombox and module:Message box. Where to set which switch? (at the moment, I'm not in to learning that; so just do it please. I'll see). - DePiep ( talk) 21:47, 25 March 2015 (UTC)
|small=yes
to {{
transwiki guide}} to output a small template. —
Mr. Stradivarius
♪ talk ♪ 06:43, 26 March 2015 (UTC)
Hi, can anyone give me a quick greatest-hits of visualization modules that have been built on-wiki here? I'm aware of Module:Chart for starters. Res Mar 20:47, 28 March 2015 (UTC)
I wrote a module that one of it's functions returns text formatted using a template. When invoking the function the template doesn't get expanded.
What am I doing wrong?
Thanks, אלישיב ליפא ( talk) 08:44, 31 March 2015 (UTC)
A few links:
A link to the module: https://he.wikisource.org/wiki/%D7%99%D7%97%D7%99%D7%93%D7%94:%D7%A4%D7%A8%D7%A9%D7%9F_%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A
An example is (currently) in the sandbox of he.wikisource
Hi. I'm using a Lua module to create some functionality, and the call to the module seems to break lines. I have no Idea why this is happening, and I hope someone can help me.
Example for a break: https://he.wikisource.org/wiki/%D7%A9%D7%95%D7%9C%D7%97%D7%9F_%D7%A2%D7%A8%D7%95%D7%9A_%D7%97%D7%95%D7%A9%D7%9F_%D7%9E%D7%A9%D7%A4%D7%98_%D7%A4%D7%95
אלישיב ליפא ( talk) 20:18, 31 March 2015 (UTC)
I have a page User:Ahmetyal/sandbox/2 which I wan't to move from a template to a module, because I have reached the limit with locations. -- Ahmetyal ( talk) 09:28, 19 April 2015 (UTC)
Is it possible to add another Archive title here (line 92)? So, By default (without adding any prefix) module will show Archive title 1 or Archive title 2 or both If archive title exist. I need this option for bengali wikipedia because on bn.wiki some user use their archive title as 'User:name/Songkolon 1' & some user use their archive title as 'User:name/Songrohoshala 1'. Here i tried to do this. Feel free to edit or make any changes here or here. Please help, Thanks -- Aftabuzzaman ( talk) 00:16, 26 April 2015 (UTC)
|prefix=whatever
when invoking the module (that replaces "Archive" with "whatever"). They would probably want to also use |prefixspace=yes
which adds a space to the end of "whatever". If wanted, prefixspace can be omitted, and prefix can be set like this: |prefix=whatever 
.
Johnuniq (
talk) 11:27, 5 May 2015 (UTC)Hi, I am from Bhojpuri wikipedia (bhwiki). I am designing our community portal and I need a template which can enlist and show all the pages in a category on the page where it is inserted. is it possible to get somthing like this?-- Satyam Mishra --talk-- 18:58, 25 May 2015 (UTC)
{{#categorytree:Geography|hideroot|mode=pages|namespaces=0}}
See Template talk:Val § Behaviour on substitution. – Wbm1058 ( talk) 15:12, 2 June 2015 (UTC)
in one of the recent software updates, we received a new extension: mw:Extension:Graph. this can and should replace everythig we do, for instance, in Module:Chart: it can do barbraphs, pie charts, and so much more.
the problem with this extension is somewhat similar to the problem with mw:Extension:Timeline, which was the previous charting tool (it still exists, but is obsolete): it does not use syntax which is familiar and convenient to wikipedia editors.
now, some time ago i wrote Module:Chart, which plots pie charts and bar graphs. the implementation is disgusting, if i say so myself, because of the very limited support vanilla html provides for charting: the bars are generated by "div" elements with absolute positioning, and the pie chart is based on some obscure features of the way html renders borders (the exploitation itself is ingenious, IMO, and is taken from Template:Pie chart).
i kinda like the syntax used by Module:Chart - i think it lets the editors provide the meaningful data, and hides from them all the mundane details. i asked on this page, several times, for suggestions to make the syntax even better, but there was not much response.
the request here is simple: create a module that will receive parameters in the same syntax used by Module:Chart, but instead of using obscure and perverse methods to draw the graph, will use then new Graph tag.
as a second round, we should use this extension to support more chart types: line chart, scatter chart, horizontal bar graph, and if someone will gets really ambitious, maybe 3-d bar chart.
as a side, i'll mention that the graph extension can do more than just charts - this should be left as an exercise for other modules.
i believe the extension supports all the charts that can be found here: here, but i cant guarantee this is the case.
peace - קיפודנחש (aka kipod) ( talk) 17:00, 8 May 2015 (UTC)
frame:extensionTag
to get the graph to render.
Anomie
⚔ 23:29, 8 May 2015 (UTC)
Hi קיפודנחש (aka kipod), Anomie, Resident Mario, have a look at this by Mps:
I want to write a new template that will be invoked as follows:
It should display in the article as follows:
IT\ICCU\MIL\0205279 should be a clickable external link coded as follows:
My problem...I don't know how to parse the template's parameter to get "MIL" and "0205279", how to concatenate "MIL" and "0205279" to produce "MIL0205279", and how to stick "MIL0205279" into the middle of the external link's definition. I'm guessing Lua.
If you would please help me this first time, citing relevant Wiki pages along the way, I'll be able to handle it myself in the future. Thanks. Knife-in-the-drawer ( talk) 16:13, 28 June 2015 (UTC)
..
, Lua's concatenation operator. ('ab' .. 'cd'
will give you the string "abcd".) The sandbox is simpler, but it isn't as elegant if something goes wrong - try putting a bad code into both of them to see what I mean. And please ask if you have any questions about the code. —
Mr. Stradivarius
♪ talk ♪ 00:45, 29 June 2015 (UTC)
I've made a feature request for
module:Infobox here:
Infobox, header-when-not-empty. Basically, it adds a parameter |headern-cond=
that only shows when its section contains data (consider how it has to be encoded today).
There is some good support, it's 'only' needs to be encoded in Lua. Anyone interested? - DePiep ( talk) 18:51, 28 June 2015 (UTC)
I'm taking first baby steps in Lua. What I want to do I could do in minutes in perl with regular expressions, but even the online Lua help materials aren't much help, because Scribunto's requirements for how it does thing are so rigid. I've barely gotten it to return (sometimes) a valid result for the first part of this I'm testing (just numerals, and without need to <nowiki>...</nowiki>
the input). I haven't figure out how to use boolean operators with Lua string manipulation, as in "look for this OR that".
-
, .
and numerals.My immediate need for this is converting sloppy CSS-related input like -10px
, 2.2em;
or even style="font-size: 70% ;"
to -10
, 2.2
, or 70
, respectively, and return that number. My assumption is that I should be able to wrap the input in <nowiki>...</nowiki>
, in case someone inputs something daft like |style=font-size: 70%
, with a |
symbol, but that's not essential. The #1 use would be conversion of percentile values in particular, like 70%
, to bare numbers, like 70
. Need a variant function that divides the result by two and rounds to two decimal places, but I'm sure I can add that myself after I see how the main part works.
.
followed by a numeral; or-
or the proper negative/minus glyph −
followed by either of:
.
followed by a numeral.
, unless one was matched earlier;.
is found, or any other non-numeral is found);^
or e
, and x
or ×
or *
when found in a context that indicates an exponent (23.5x10^8
), and a few other such cases (e.g. characters used to indicate a truncated long/endless decimal)Any help on the basic request at the top would be much appreciated, the rest is more of a "what if...?" proposition. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 22:33, 17 July 2015 (UTC)
function ExtractNumbers(str)
local tResult = {}
str:gsub( "%-?[%d%.]+", function(x) table.insert(tResult, x) end)
return tResult
end
myvar = ExtractNumbers('style="font-size: 70% ;"')
myvar = ExtractNumbers('style="font-size: 70% ;"')[1
font-size: 10%
will come out as -10%
. Your use of a table is probably more robust, too; I just did enough to get the result I immediately needed for a specific application, conversion of "70%" to "70", and the ability to halve it. Anyone should feel free to tinker further. —
SMcCandlish ☺
☏
¢ ≽ʌⱷ҅ᴥⱷʌ≼ 14:51, 18 July 2015 (UTC)
onlyNumber = (string.gsub(theString, "[^%d%.-]", ""))
to onlyNumber = (string.match(theString, "%-?[%d%.]+"))
would help with the problem with font-size: 10%
. It would also just retun the first set of numbers rather than all numbers in theString. --
WOSlinker (
talk) 16:36, 18 July 2015 (UTC)
Please see Template talk:Multi-section link#Development request. Short version: Need variant that links each sectional name, not just the last one. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 18:55, 23 July 2015 (UTC)
After going through these requests, I found and completed a recent one( here) that I've wanted to create since lua was announced in wikia:
Anyway, in wikia modules are listed [1] so feel free to import any modules you find useful (I've shamelessly imported many from here anyway :). Unlike mediawiki's scribunto, wikia has global modules that can be accessed from any other wikia, however they haven't really become popular yet (almost nobody adds modules to dev.wikia). So maybe those interested can import modules from there to here or here to there or even collaborate on some modules.
Wikia's scribunto doesn't have all libraries available in mediawiki though, so some scripts that work here may not work there.
Announcement,module and github merge:
Dessamator 197.218.89.127 ( talk) 14:49, 15 August 2015 (UTC)
The source code of this template is verbose, redundant, and difficult to read. It should be re-written as a Lua module so that it can be maintained more easily. Jarble ( talk) 01:27, 19 June 2015 (UTC)
{{helper| {{{prefix|}}} | {{{suffix|}}} | {{{noredlinks|}}} | Angola }} {{helper| {{{prefix|}}} | {{{suffix|}}} | {{{noredlinks|}}} | Denmark }} ... (repeat for all countries)
|GE=Foo of Georgia
);|article=
parameter to either enforce or prevent the definite article (using the current "prefix but no suffix" rule if unspecified);Module:User:Doc Taxon/Hello and user:Doc Taxon/Hello
Hi, I am looking for help creating a loop by Lua. I want the script to output the hello line 5 times, but I get back this: "Lua error in Module:User:Doc_Taxon/Hello at line 10: attempt to concatenate global 'u' (a table value)." What can I do? Thank you very much Doc Taxon ( talk) 15:07, 12 October 2015 (UTC)
local name = frame.args1
if not name then
name = 'World'
end
local name = frame.args1 or 'World'
if not a then
do_something()
end
a or do_something()
if a then
do_something()
end
a and do_something()
false
and nil
are falsy in Lua. There is no distinction between null
and undefined
as there is in JavaScript, and in Lua the spelling is nil
, never null
. —
Mr. Stradivarius
♪ talk ♪ 10:12, 16 October 2015 (UTC)I'm requesting Module:Location map/data/Pyongyang (cf. Module:Location map/data/Istanbul). The map image can be found at File:Map Pyongyang.jpg. The relevant country level location map template is at Template:Location map North Korea. For reference, the requested module already exists on the French ( fr:Modèle:Géolocalisation/Pyongyang) and Polish ( pl:Szablon:Mapa dane Pjongjang) language Wikipedias. Finnusertop ( talk | guestbook | contribs) 12:51, 15 October 2015 (UTC)
Previously, I
pinged some users to bring attention to this discussion. Their attention was no longer needed after the reply below. Sorry for the inconvenience.
Right now, Commons has
a
collection
of
war
maps which are frequently updated using data from collaboration which happens on the English Wikipedia for each map. A problem exists where the date these war map images were last updated needs to be distributed to articles which use the maps, so that users can know how up-to-date they are ("current as of 10 Nov 2015" or something). This problem is currently being solved using
this module which might as well be a template and has to be manually updated. Is it possible, using Lua, to automate the retrieval of this date, or possibly generalise it to any file so that future maps can also have this convention applied to them? If it isn't possible using lua, I'm strongly considering writing a bot which does this automatically. Thanks in advance. --
BurritoBazooka (
talk) 02:07, 10 November 2015 (UTC)
{{REVISIONTIMESTAMP: File:filename}}
, but that only works for files on the local wiki, and it also includes edits to the file description page as well as new uploads. If that works for you, you can call it from Lua using frame:callParserFunction('REVISIONTIMESTAMP', 'File:Filename')
. Best —
Mr. Stradivarius
♪ talk ♪ 02:46, 10 November 2015 (UTC)
I'm curious to know what the p stands for? Is it program? public? -- Psychoslave ( talk) 12:50, 25 November 2015 (UTC)
The current {{ Zodiac date}} gives wrong answers for 2015. The approach of finding an empirical formula to predict dates of astronomical events is both not feasible and original research. I'm thinking of creating a Lua program that would have 12 tables, one for each sign of the zodiac. Each table would have a list of years from 2015 through 2050 (which is as far as my reliable source will predict). The index of the table would be the year, and the result from the table would be a day of the year (e.g "Feb. 18". Each table would have 35 rows.
I haven't programmed in Lua before, but I've programmed in many other languages from System/370 assembler to C#, so I'm not worried about figuring out the language. But I am concerned that having such a large template might be detrimental to the articles that include the template. Am I on the right track? — Preceding unsigned comment added by Jc3s5h ( talk • contribs) 14:30, 29 November 2015 (UTC)
Is it possible to scan the contents of articles for specific text strings (actually template) based on a list of articles in a category and its sub-categories? I would like to make these table numbers dynamic. -- Traveler100 ( talk) 18:03, 4 January 2016 (UTC)
If anyone has some spare time then perhaps do a code review of Module:Timing? And the doc page needs a spell check too! I believe the precision in the produced numbers are about as they get, but there could be other ideas out there. Note that this solution are for those that develop code on their own, without a debugger running in a controlled environment. Note also that the test cases are written for another library, and that it does not work as of this writing. Hopefully it will work later on. Jeblad ( talk) 18:03, 18 January 2016 (UTC)
for
loop with no purpose?math.pow
but it is the same as v^2
.#timing == 0
even if I thought it couldn't happen.time[i]
on the lhs.p.combine
is part of p
? Why not just a local function, if module users don't need to access it? Similar for other functions.local function dummy()
" as I don't think a global is needed.p.combine
was an access point for testing, could be put inline insteadfunction dummy()
is used for baseline timing, and usually you will not test local functionsdummy = 'hello'
would wipe out the dummy function. By "pretty rare" I meant that it would be rare to need to test the timing of a module. I understand that you don't use Module:Timing in another module, but nearly all modules run very fast and don't need to be optimized. I would think any modules that are too slow are just trying to do too much work, and only a very small number of modules would benefit from measuring the time taken by various functions. As mentioned, I had one of those rare exceptions a few days ago where I found a bottleneck that was removed by using a different method. However, I was doing a ridiculously large number of tests just from interest to see how long it would take.
Johnuniq (
talk) 10:24, 19 January 2016 (UTC)
dummy = 'hello'
would have some implications. I haven't checked timing for local lookup, but usually that is much faster in other languages. Often by a factor ten or more. I can put the dummy function in the exported lib, that would be close enough.=require 'Module:Timing'(p.hello)
. In the timing module, timing for the following would then be obtained:
self.runner(dummy, ...)
self.runner(func, ...)