Hi! This page is the official Ajuanca´s sandbox. To know more about what a sandbox is, visit this page.
TASK 1 edit
Great Blue Heron and immature Bald Eagle on the Platte River.jpg
imgs
TASK 2 edit
Q1. What keyword marks the start of a function definition?
A1. The keyword is function
.
Q2. Which letter is conventionally used in Scribunto modules to hold the table of functions? A2. The common letter used is p.
Q3. What keyword marks the end of a function definition?
A3. The keyword is end
.
Hello, world!
Hello from Lua to my friend Ada.
TASK 3 edit
5 degrees Celsius is 41 degrees Fahrenheit. That's the same as say 278.15 Kelvin. It is cold.
25 degrees Celsius is 77 degrees Fahrenheit. That's the same as say 298.15 Kelvin. It is warm.
0 degrees Celsius is 32 degrees Fahrenheit. That's the same as say 273.15 Kelvin. It is cold.
-8 degrees Celsius is 17.6 degrees Fahrenheit. That's the same as say 265.15 Kelvin. It is cold.
48 degrees Celsius is 118.4 degrees Fahrenheit. That's the same as say 321.15 Kelvin. It is warm.
- When the temperature is 9, the comparison considers it smaller. I added a specific answer for temperature equals 9:
9 degrees Celsius is 48.2 degrees Fahrenheit. That's the same as say 282.15 Kelvin. It isn't neither warm nor cold.
- When no value is given to celsius parameter, it considers that it isn't given:
0 degrees Celsius is 32 degrees Fahrenheit. That's the same as say 273.15 Kelvin. It is cold.
- When the wrong variable type is written, it considers that it isn't given:
0 degrees Celsius is 32 degrees Fahrenheit. That's the same as say 273.15 Kelvin. It is cold.
TASK 4 edit
Tables edit
Extended content
|
---|
The 4 times table.When no number is given or no parameter is sended, the default value is used. Instead of 2, the default number is generated randomly between -12 and 12, and in this case is -7.1 times 4 equals 4 2 times 4 equals 8 3 times 4 equals 12 4 times 4 equals 16 5 times 4 equals 20 6 times 4 equals 24 7 times 4 equals 28 8 times 4 equals 32 9 times 4 equals 36 10 times 4 equals 40 11 times 4 equals 44 12 times 4 equals 48 The -7 times table.When no number is given or no parameter is sended, the default value is used. Instead of 2, the default number is generated randomly between -12 and 12, and in this case is -7.1 times -7 equals -7 2 times -7 equals -14 3 times -7 equals -21 4 times -7 equals -28 5 times -7 equals -35 6 times -7 equals -42 7 times -7 equals -49 8 times -7 equals -56 9 times -7 equals -63 10 times -7 equals -70 11 times -7 equals -77 12 times -7 equals -84 The -7 times table.When no number is given or no parameter is sended, the default value is used. Instead of 2, the default number is generated randomly between -12 and 12, and in this case is -7.1 times -7 equals -7 2 times -7 equals -14 3 times -7 equals -21 4 times -7 equals -28 5 times -7 equals -35 6 times -7 equals -42 7 times -7 equals -49 8 times -7 equals -56 9 times -7 equals -63 10 times -7 equals -70 11 times -7 equals -77 12 times -7 equals -84 The -7 times table.When no number is given or no parameter is sended, the default value is used. Instead of 2, the default number is generated randomly between -12 and 12, and in this case is -7.1 times -7 equals -7 2 times -7 equals -14 3 times -7 equals -21 4 times -7 equals -28 5 times -7 equals -35 6 times -7 equals -42 7 times -7 equals -49 8 times -7 equals -56 9 times -7 equals -63 10 times -7 equals -70 11 times -7 equals -77 12 times -7 equals -84 The -9 times table.When no number is given or no parameter is sended, the default value is used. Instead of 2, the default number is generated randomly between -12 and 12, and in this case is -7.1 times -9 equals -9 2 times -9 equals -18 3 times -9 equals -27 4 times -9 equals -36 5 times -9 equals -45 6 times -9 equals -54 7 times -9 equals -63 8 times -9 equals -72 9 times -9 equals -81 10 times -9 equals -90 11 times -9 equals -99 12 times -9 equals -108 |
People edit
Hello Agnetha
Hello Betty
Hello Carlos
Hello Davinder
Hello Eloise
Hello Martin
Hello Doug
Hello Diego
TASK 5 edit
Sub-strings and case edit
This is simple
Patterns and matching edit
Q1. What does %w+ match in a Lua pattern? A1. As it's written in the documentation, it represents all ASCII alphanumeric characters. In this case, they'll correspond to the month.
Q2. What does %d+ match in a Lua pattern? A2. As it's written in the documentation, it represents all digits. In this case, they'll correspond to the day or year.
Year = 2018
Day = 31
Month = October, that is the tenth month.
Yes, I can figure out how does it works. The input is passed to the function and then saved to the variable dmy
. After that, there're declared three variables that will come from casting dmy
into three pieces, thanks to the method string.match
that, as it's written in the documentation, it compares the first parameter, in this case, dmy
, with a given parameter as a second attribute, in this case, numbers characters numbers
, that are saved corresponding to the variables d
, m
and y
. Finally, the variables are concatenated with some text and returned.
In order to get the values of the day, month and year in this format, we should modify the line that saves each value in the variable, searching in the first place instead of the day the month, in second place the day and lastly the year. Note that as also a comma (,) is introduced, we also should cast it. I made a function p.unpackUS
that applies this changes. I also implemented some lines to get the ordinal position of the month. In the above example, the given value was "mdydate=October 31, 2018"
Year = 2018
Day = 31
Month = October, that is the tenth month.
TASK 6 edit
Languages libraries for MediaWiki edit
WikiMedia possible languages edit
Extended content
|
---|
oc - occitan |
Fallback languages edit
is fallback languages
1 - en
There's 1 possible plan-Bs languages.
cv fallback languages
1 - ru
2 - en
There're 2 possible plan-Bs languages.
kk fallback languages
1 - kk-cyrl
2 - en
There're 2 possible plan-Bs languages.
Pageinfo edit
Get title edit
Extension:Scribunto/Lua reference manual
Basic information edit
Test 1 edit
The input is Color
Color exists and isn't a redirect.
Test 2 edit
The input is Colour
Colour exists and is a redirect.
Test 3 edit
The input is Colr
Colr doesn't exist and isn't a redirect.
Test 4 edit
The input is Polymerase
Polymerase exists and isn't a redirect.
Test 5 edit
The input is UK
UK exists and is a redirect.
Test 6 edit
The input is Wikimedia_foundation
Wikimedia_foundation exists and is a redirect.
Experimenting edit
- When you give the character
*
, the function is called and the Wikimedia syntax interprets it as a bulleted-list item. - exists and is a redirect.
- When you give
#
, a non-related Sandbox problem appears:
Lua error in mw.title.lua at line 206: bad argument #1 to 'pairs' (table expected, got nil).
- When no attribute is given, the following error appears:
Lua error: bad argument #1 to 'title.new' (number or string expected, got nil).
- When no value is given to the attribute (
titleOfPage=
):
You need to give a value to the titleOfPage attribute.
- When you request a page that existed but now is deleted:
Like_this_one doesn't exist and isn't a redirect.
Non-requested implementations edit
- Now detects subpages and talk pages:
The input is Talk:Australia
Talk:Australia exists and is a talk page.
The input is Wikipedia:Tip_of_the_day/March_8
Wikipedia:Tip_of_the_day/March_8 exists and is a subpage.
Organize all languages [in development] edit
- Return list with ordered languages.
TASK 7 edit
Fetching a date edit
In the below example, we can see how the data is returned from the Wikimedia database. A +
precedes the date (obviously a time-data type). After it, the year, a -
, the month, another -
, the day, and without any separation, a T
that indicates the start of the specific time in the form hh:mm:ss
, which null value is 00:00:00
, and finally, also without separation, a Z
.
+1952-03-11T00:00:00Z
- The input is
qid=Q42
andprop=P569
.
The year is 1952, the month is 03 and the day is 11.
This date in an ISO-style is 1952-03-11.
- The input is
qid=Q151973
andprop=P569
.
The year is 1925, the month is 11 and the day is 10.
This date in an ISO-style is 1925-11-10.
- The input is
qid=Q34851
andprop=P570
.
The year is 2011, the month is 03 and the day is 23.
This date in an ISO-style is 2011-03-23.
Fetching a full date edit
- The input is
qid=Q42
andprop=P569
.
11 March 1952
- The input is
qid=Q151973
andprop=P569
.
10 November 1925
- The input is
qid=Q34851
andprop=P570
.
23 March 2011
Fetching an item edit
- The input is
qid=Q42
andprop=P1196
.
natural causes
- The input is
qid=Q151973
andprop=P26
.
Elizabeth Taylor