User talk:Uncle G~test2wiki

Page contents not supported in other languages.
From Wikipedia

Lua error function[edit]

The error function seems a bit limiting as it currently stands. It could really do with an option to add the transcluded page into a specified category, so for exmaple in convert instead of just

error ("Module:Converting between " .. in_unit .. " and " .. out_unit .. " not supported.")

we could have

error ("Module:Converting between " .. in_unit .. " and " .. out_unit .. " not supported.", "Usage of convert with invalid unit parameter")

which would add the article to category:Usage of convert with invalid unit parameter. -- WOSlinker (talk) 20:34, 4 September 2012 (UTC)[reply]

  • Generation of wikitext, be it for a categorization or something else, is success, not an error. Error in this case should be reserved for the times where you really do want the poor reader to be pointed at some line of Lua code that xe is expected to fix if xe follows the hyperlink in the error message. I've largely left Module:Convert alone, in order to give other people something meaty to chew on. I've just given you a second and a third thing to think about and expand upon. The third is that functions don't have to return just one thing. Be careful with the second. It catches everything. ☺ Uncle G (talk) 19:54, 5 September 2012 (UTC)[reply]

Importing another module[edit]

Hi! I'm having some trouble importing a module. I have imported it, but there is then an error saying that the things that are supposed to be available are not. Look at Module:CodeCat/links to see what I mean. What am I doing wrong? CodeCat (talk) 20:13, 6 September 2012 (UTC)[reply]

  • You're requiring the module, then throwing away the only way to access it (given that it doesn't set any global variables). require() returns the table constructed by the required module. You need to keep that around somewhere, in order to use it. Uncle G (talk) 22:47, 6 September 2012 (UTC)[reply]
    • Oh, I see. I'm more familiar with Python, where you can import a module but you don't need to assign it to anything. I have another question though. On Wiktionary we have a very large number of language code templates; basically all of ISO 639-3. Those templates also have subtemplates to give extra properties to the codes such as script, language family and so on. Essentially it's a very large database. We've been wondering how this system would be best ported to Lua. We could add all the information to a single module, but that module would become very large, even though most pages would not need more than 1% of the information stored in it. But if we split it up, we no longer have a single unified system of accessing the data. Do you have any ideas? CodeCat (talk) 22:58, 6 September 2012 (UTC)[reply]

Module:Author fr[edit]

In fr:wikisource we use fr:s:Modèle:Auteur which I extended with 6 sub-templates, see the end of doc. A week ago fr:s:Utilisateur:Tpt asked to install Scribunto in our wiki but he understood today that we must wait for it some months. Then I must deploy first a more flexible HTML version of Modèle:Auteur. And only later develope here a LUA version.
Today I also seen a change in the args at calling time. --Rical (talk) 21:42, 6 September 2012 (UTC)[reply]

First attempts at scribbling[edit]

Hello Uncle G. This is SemperBlotto from the English Wiktionary.

I have had a first attempt at a very simple Scribbled module / template that has ended in a dismal failure. See Module:It (should really be lowercase, but ignore that), Template:itadv, and my user page as a testbed. Any ideas what I have done wrong? SemperBlotto (talk) 15:37, 7 September 2012 (UTC)[reply]

Module:Convert[edit]

Thanks for your improvements at Module:Convert—the SIprefixes table will avoid having a massively large conversion table with a lot of duplication. I'll tweak how it works for a more efficient lookup in due course.

I have been very confused about the scale/offset issue for some time, but have tried to ignore it while working on rounding. However, I think I have now got it clear, and you will see that I made a few changes. There's one minor issue that I'm curious about. You had:

    if #unit > plen and prefix == unit:sub(1,0+plen) then

and I removed the "0+". I'm very new to Lua, so please let me know if there is something I've missed.

Is there somewhere that devs are discussing Scribunto? I know they don't want to spend time fielding questions, but I am also wondering about the issue that CodeCat mentioned above: is Lua's bytecode cached in MediaWiki so Module:Convert would not be compiled whenever an article cache is updated?

At any rate, I suspect that eventually I would like to have another module which contains only the conversion tables, and "require" that from the main module. That should be efficient, and would make the main module easier to digest once the tables get a lot of data added. Also, it would make it easier to implement my plan of writing a script to generate the tables from a human-friendly input file. Any thoughts on that? What about "Convertdata" for the module name? Johnuniq (talk) 10:09, 9 September 2012 (UTC)[reply]

Possible problem with argumentPairs[edit]

I have been wondering how argumentPairs works, so I wrote a small test, see User:Johnuniq/sandbox.

While thinking about all the complexity of Template:Convert at enwiki, I found yet another case where an unnamed template argument needs to be interpreted based on a named argument ("adj=mid"). See first example in above sandbox. Johnuniq (talk) 10:46, 10 September 2012 (UTC)[reply]

  • You're misusing frame:argumentPairs(). Per Ierusalimschy 2003 §7.3, pairs() makes no guarantee of any particular table ordering, and neither, by analogy, does frame:argumentPairs(). If you want to process an arguments table from 1 to N in that specific order, then you really do have to use a while loop, just like in the Guide. If you need to test args.adj before processing the numerical fields in the arguments table, so that you know whether to look for an extra argument before the rounding parameter, then you really do have to write code that does that. A generic for loop calling these table iterators provides no guarantee of ordering . Uncle G (talk) 22:08, 10 September 2012 (UTC)[reply]
    • I don't know how argumentPairs is implemented, but if it's a Lua layer, your analogy would apply (I was thinking it might be some specially crafted interface which would merely process the arguments sequentially). However, I think I was misled by the Template:Convert docs as it is a considerable time since I've done any significant template work. The docs suggest some parameters need to be in a certain order, but on reflection, a template processing |adj=mid|bridge has no way of working out that bridge is what comes after adj=mid. Instead, it must be guessing what numbered argument applies, and that's the same as what Module:Convert will have to do. BTW, I have digested your excellent guide (you might have noticed I fixed a typo). Johnuniq (talk) 12:03, 11 September 2012 (UTC)[reply]

Advice needed about module construction[edit]

Hi there. I am investigating the scribbling of Italian conjugation templates for en.Wiktionary and have a problem. Sorry, this might be a bit long. I shall start by explaining how they currently work.

A template "it-conj" builds a pretty table of all the conjugated forms of a verb. See wikt:parlare for an example. As most verbs are pretty regular we have a small number of templates to handle these regular forms ("parlare" uses it-conj-are for example). Each of these templates calls it-conj passing a large list of parameters, one for each conjugated form of the verb (for "third person plural past historic" and the like). Regular verbs use the regular templates and pass just two parameters (principally the stem of the verb). Verbs that are a bit irregular use the regular templates as well, but override, add to, or remove individual forms. Very irregular verbs use it-conj itself passing a long list of parameters (see wikt:essere or wikt:nevicare as examples).

Now when converting to scribbled templates we don't want to make any changes to individual verb entries (there are thousands). I have written a first attempt at the scribbled version of it-conj (see module "Itconj" for the module, and my User page for some tests of it). It gets its parameters via pframe.args, and works reasonably well when called directly (via template:it-conj), and when called via a current curly-bracket template (see template:it-conj-are) (all on this wiki).

But now I want to scribble one of the regular templates that call the it-conj template. I started to code a second function (p.itconjare) within the itconj module but then realised that I didn't know how to pass all the parameters. The p.itconj function just takes a single (frame) parameter and gets all the real parameters via pframe.args.

I would appreciate any advice on how to structure the scribbled templates/modules. I was wondering if I will have to change the p.itconj function to get all its parameters from the template (currently template just has "#invoke:Itconj|itconj"). Cheers SB (sorry for long question) SemperBlotto (talk) 15:25, 12 September 2012 (UTC)[reply]

You could try this way : s = s .. p.spanColor({args = {'- red -', '#EE8899'}})
See the use in this example near the end. --Rical (talk) 16:19, 12 September 2012 (UTC)[reply]
Forget it. I've thought of a better method that would use just a single module and single function. I'll get to work on it soonish. SemperBlotto (talk) 10:05, 14 September 2012 (UTC)[reply]

How do i fix this?[edit]

Hi, this is the User:Pinky Jones

How come the template:infobox televsion in en.wikipedia has the bigger header style but in test2.wikipedia has the smaller version?

I want to change the template:infobox television (test2.wikipedia) to a new version which is the en.wikipedia. I did copy the code through en.wikipedia and paste it on test2.wikipedia but the header is still different.


Infobox television (test2.wikipedia)
File:Capture-20140929-200142.png


Inforbox television (en.wikipedia)
File:Bigger.png

Your account will be renamed[edit]

22:30, 13 March 2015 (UTC)


Renamed[edit]

02:25, 16 April 2015 (UTC)

Renamed[edit]

12:03, 19 April 2015 (UTC)