[Lua task #09] Using MediaWiki Libraries
To work on this, you must have successfully finished the task "[Lua task #08] Tables in Lua" before!
This task requires research and independent learning. It may not be suitable for beginners to programming.
Read the Module documentation at Module:Sandbox/RexxS/GCI09 and check the pages linked.
1 Copy the function 'langnames' from https://en.wikipedia.org/wiki/Module:Sandbox/RexxS/GCI09 to your module sandbox. Read https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#mw.language.fetchLanguageNames to work out what it does. The for loop demonstrates an example of how we could extract all of the data in a table into a string that we can return to the wiki-page.
2 Write a call in a new section of your sandbox called ==Task 9==
that calls 'langnames' from your module sandbox.
I want a function called 'pageinfo' that takes a title as a parameter and returns some information about the corresponding Wikipedia page. Here are some examples of what I want it to display:
- Color exists and is not a redirect
- Colour exists and is a redirect
- Colr does not exist and is not a redirect
3 In your module sandbox, write a function that uses mw.title.new from the manual to create a title object that we can use to test whether the given title exists and whether it is a redirect. If you need a start, copy the code from https://en.wikipedia.org/wiki/Module:Sandbox/RexxS/GCI09a and improve on that.
4 In your sandbox write 6 test cases to show your module works. Link it from here.