Page MenuHomePhabricator

Create your own Lua module on English Wikipedia [Lua step 3 of 3]
Closed, DeclinedPublic

Description

To work on this, you must have successfully finished the task "[Lua task #2] Use Lua on English Wikipedia" before!

You can write your own Lua functions using your sandbox module to try out code. You can then use your sandbox to call a function from your module and see how well it works.

  1. Read the "Introduction - Getting started" + "Introduction - Module structure" sections.

Make sure you understand that the module begins by defining an empty table, then defines functions (adding them to the table), and finally returns the table.

  1. Copy the following questions into your sandbox (not your module sandbox):

Which letter is conventionally used in Scribunto modules to hold the table of functions?
What keyword marks the start of a function definition?
What keyword marks the end of a function definition?

  1. Write your answers to the 3 questions in your sandbox.
  1. In your module sandbox you should just have a comment (-- Google Code-in 2017, Introduction to Lua in Wikipedia). On a new line write another similar comment with the name of this task.

Save the module.

  1. Below that comment, copy all of the code needed to produce the hello function from the example

Include the initial line beginning local ..., and the final line beginning return ....
Save the module.

  1. Work out what you need to write in your sandbox in order to call the hello function from your module sandbox. Write that in your sandbox and test it by previewing the edit. When you have no errors, save the sandbox.

Event Timeline

I will mentor this in Google-Code-in-2017

Aklapper renamed this task from Lua Task 3 - Creating your own Lua module to Create your own Lua module on English Wikipedia [Lua step 3 of 3].Dec 7 2017, 3:42 PM
Aklapper updated the task description. (Show Details)
Aklapper moved this task from Proposed tasks to Imported in GCI Site on the Google-Code-in-2017 board.

Closing this task as it was a placeholder in Phab for Google-Code-in-2017 which is ending these days (no more new tasks can be claimed from now on in GCI 2017).