Module talk:category tree/requests

Using gsub to add text content
I think it would make the code more understandable if the module used lua to add content, rather than lua. That could be done by replacing lua with variables defined with symbols, such as lua or lua, creating a table of variables, then using lua to replace the variables with their values, once the full output string has been generated. This is done in, for instance, the Arabic conjugation module, Module:ar-verb, to put verb forms into the table. (It's also quite nifty.) — Eru·tuon 20:15, 20 May 2017 (UTC)

I've created a version of the module that does this, at Module:User:Erutuon/requests. What do you think? — Eru·tuon 21:05, 20 May 2017 (UTC)
 * I saw your version of the module, but please feel free to do whatever you want as long as it works. I'm not very knowledgeable about the niceties of Lua. I'll trust your judgement. --Daniel Carrero (talk) 00:31, 21 May 2017 (UTC)
 * Done! Now the things (language name, language code, etc.) that are put into the generated text are contained in a table (lua), so they can be accessed by lua. I'm pretty sure it works correctly, but I will check some more to make sure. — Eru·tuon 00:51, 21 May 2017 (UTC)
 * Had to redo it. Most of the variables are now in the lua table, which makes them a little annoying to type out. Added some newlines and tabs to make the code more readable. — Eru·tuon 03:12, 21 May 2017 (UTC)
 * That's nice, but unfortunately now it seems there's some problem with.
 * Category:Requests for attention concerning French should be in Category:Requests for attention by language, but it isn't.
 * Category:Requests for definitions in French entries should be in Category:Requests for definitions by language, but it isn't.
 * the same with other categories
 * --Daniel Carrero (talk) 04:57, 21 May 2017 (UTC)
 * : I reverted your recent edits. Feel free to check your new code and do your improvements again.
 * When you re-edited the module on May 21, the aforementioned problem got worse: Apparently, all the requests categories became uncategorized themselves. For example, Category:Requests for images in English entries was not a member of any categories (apart from the category "Hidden categories"). --Daniel Carrero (talk) 16:47, 22 May 2017 (UTC)
 * Good that you reverted. I was noticing more problems too. I added the testing function again though. — Eru·tuon 18:15, 22 May 2017 (UTC)