Uporabnik:Vitosmo/LuaTestCases

Learning material / examples from [User:RexxS/GCI]

Task 7 - Wikibase client

uredi

-https://en.wikipedia.org/wiki/User:RexxS/GCI-2018-Task07

fetch item

uredi

could be usefull:

WikiData: | WikiDataDOC - for templates

qualifier IDs: | Wikidata qualifiers

fetch date this and that way

uredi

-- fetching the full date

birthday of Richard Burton 10 November 1925

date of death of Richard Burton 05 August 1984

birthday of Elizabeth Taylor 27 February 1932

date of death of Elizabeth Taylor 23 March 2011

-- fetching a date

birthday of Richard Burton Year = 1925, Month = 11, Day = 10

date of death of Elizabeth Taylor Year = 2011, Month = 03, Day = 23

birthday of "Q42" = +1952-03-11T00:00:00Z

birthday of "Q42" = +1952-03-11T00:00:00Z

birthday, edited = Year = 1952, Month = 03, Day = 11

Task 6 - MediaWiki libraries

uredi

page info

uredi

Barva exists

Barve exists and is redirect

Farbe does not exist


page title

Extension:Scribunto/Lua reference manual

Fjodor Mihajlovič Dostojevski


page size

jezero: 5334

Matsuo Basho: 30


mw.language

uredi

hr fallbacks :1 language
, 1 - en

bs fallbacks :1 language
, 1 - en

sk fallbacks :2 languages
, 1 - cs, 2 - en

si fallbacks :1 language
, 1 - en

557 languages
, oc - occitan, sc - sardu, ady - адыгабзэ, ike-latn - inuktitut
ab - аԥсшәа, glk - گیلکی, sli - Schläsch, lb - Lëtzebuergesch, nb - norsk bokmål
xal - хальмг, wal - wolaytta, ast - asturianu, ca - català, ba - башҡортса, aa - Qafár af
ga - Gaeilge, sr-ec - српски (ћирилица), dag - dagbanli, kus - Kʋsaal, ja - 日本語
mus - Mvskoke, ha - Hausa, na - Dorerin Naoero, la - Latina, sa - संस्कृतम्
haw - Hawaiʻi, ruq - Vlăheşte, wa - walon, ta - தமிழ், cpx-hans - 莆仙语(简体)
scn - sicilianu, tly-cyrl - толыши, nan-hant - 閩南語(傳統漢字)
zh-min-nan - Bân-lâm-gú, mnc-latn - manju gisun, pag - Pangasinan, mag - मगही
nan-latn-tailo - Bân-lâm-gú (Tâi-lô), lij - Ligure, stq - Seeltersk, se-fi - davvisámegiella (Suoma bealde)
rki - ရခိုင်, nah - Nāhuatl, bcc - جهلسری بلوچی, lki - لەکی
crh-cyrl - къырымтатарджа (Кирилл), aeb - تونسي / Tûnsî, pcm - Naijá, pcd - Picard
tdd - ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ, cdo-hant - 閩東語(傳統漢字), bxr - буряад, ibb - ibibio, ace - Acèh
jbo - la .lojban., kbd-cyrl - адыгэбзэ, se-no - davvisámegiella (Norgga bealde)
acm - عراقي, chy - Tsetsêhestâhese, cdo - 閩東語 / Mìng-dĕ̤ng-ngṳ̄
kk-arab - قازاقشا (تٴوتە), kjh - хакас, shy - tacawit, sco - Scots, nan - 閩南語 / Bân-lâm-gú
ban - Basa Bali, gan - 贛語, shi-latn - Taclḥit, kai - Karai-karai, jam - Patois, pam - Kapampangan
mad - Madhurâ, nys - Nyunga, aae - Arbërisht, gaa - Ga, sat - ᱥᱟᱱᱛᱟᱲᱤ
kaa - Qaraqalpaqsha, zgh-latn - tamaziɣt tanawayt, lbe - лакку, lez - лезги
kbd - адыгэбзэ, gcf - kréyòl Gwadloup, kab - Taqbaylit, rgn - Rumagnôl, sah - саха тыла
bgc - हरियाणवी, szl - ślůnski, fiu-vro - võro, acf - Kwéyòl Sent Lisi, kcg - Tyap, sk - slovenčina
ksw - စှီၤ, tk - Türkmençe, mdf - мокшень, gsw - Alemannisch, kk - қазақша
mk - македонски, bar - Boarisch, syl - ꠍꠤꠟꠐꠤ, ext - estremeñu, gan-hans - 赣语(简体)
myv - эрзянь, hrx - Hunsrik, fj - Na Vosa Vakaviti, lzh - 文言, kj - Kwanyama
koi - перем коми, krj - Kinaray-a, kea - kabuverdianu, ccp - 𑄌𑄋𑄴𑄟𑄳𑄦
zh-classical - 文言, zh - 中文, pdc - Deitsch, ti - ትግርኛ, si - සිංහල, kri - Krio
hi - हिन्दी, mnc-mong - ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ, fi - suomi
hyw - Արեւմտահայերէն, li - Limburgs, ki - Gĩkũyũ, tg-latn - tojikī, dtp - Kadazandusun
bh - भोजपुरी, ch - Chamoru, shi-tfng - ⵜⴰⵛⵍⵃⵉⵜ, nmz - nawdm, kum - къумукъ
ceb - Cebuano, mui - Baso Palembang, pwn - pinayuanan
sh - srpskohrvatski / српскохрватски, tly - tolışi, tum - chiTumbuka, mh - Ebon, nup - Nupe
sh-latn - srpskohrvatski (latinica), ko-kp - 조선말, ady-cyrl - адыгабзэ, atj - Atikamekw
pih - Norfuk / Pitkern, bpy - বিষ্ণুপ্রিয়া মণিপুরী
bg - български, lg - Luganda, kg - Kongo, ng - Oshiwambo, mg - Malagasy, ojb - Ojibwemowin, ig - Igbo
tg - тоҷикӣ, sg - Sängö, ug - ئۇيغۇرچە / Uyghurche, hak-hant - 客家語(繁體)
za - Vahcuengh, gcr - kriyòl gwiyannen, shi - Taclḥit, ff - Fulfulde, af - Afrikaans
nyn - runyankore, ruq-cyrl - Влахесте, pt-br - português do Brasil
rut - мыхаӀбишды, hak-hans - 客家语(简体), ckb - کوردی, jut - jysk
mnw - ဘာသာမန်, cpx-latn - Pó-sing-gṳ̂ (Báⁿ-uā-ci̍), vmw - emakhuwa, nyo - Orunyoro
ee - eʋegbe, de - Deutsch, ce - нохчийн, be - беларуская, nds-nl - Nedersaksies
nia - Li Niha, ne - नेपाली, wuu-hans - 吴语(简体), ie - Interlingue
he - עברית, ryu - うちなーぐち, te - తెలుగు, mwl - Mirandés
tg-cyrl - тоҷикӣ, es-419 - español de América Latina, tzm - ⵜⴰⵎⴰⵣⵉⵖⵜ
nl-informal - Nederlands (informeel), yue-hant - 粵語(繁體), skr-arab - سرائیکی, hif-latn - Fiji Hindi
tt-latn - tatarça, abs - bahasa ambon, gd - Gàidhlig, sd - سنڌي, efi - Efịk
cdo-latn - Mìng-dĕ̤ng-ngṳ̄ (Bàng-uâ-cê), sh-cyrl - српскохрватски (ћирилица)
dty - डोटेली, yrl - Nhẽẽgatú, is - íslenska, ks - कॉशुर / کٲشُر
ms - Bahasa Melayu, trv - Seediq, ps - پښتو, ss - SiSwati, sty - себертатар
pnb - پنجابی, ur - اردو, se-se - davvisámegiella (Ruoŧa bealde), gpe - Ghanaian Pidgin
apc - شامي, mnc - manju gisun, as - অসমীয়া, cs - čeština, bs - bosanski
fr - français, hr - hrvatski, kr - kanuri, mr - मराठी, nr - isiNdebele seSewula
or - ଓଡ଼ିଆ, kk-latn - qazaqşa (latın), frp - arpetan, sr - српски / srpski, tru - Ṫuroyo
crh - qırımtatarca, brh - Bráhuí, smn - anarâškielâ, ar - العربية, br - brezhoneg
cr - Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ, sma - åarjelsaemien, nds - Plattdüütsch, lmo - lombard, sq - shqip
crh-latn - qırımtatarca (Latin), arz - مصرى, shy-latn - tacawit, en-ca - Canadian English, ary - الدارجة
luz - لئری دوٙمینی, be-tarask - беларуская (тарашкевіца), fon - fɔ̀ngbè
vep - vepsän kel’, ses - Koyraboro Senni, ts - Xitsonga, rmc - romaňi čhib, bdr - Bajau Sama
krl - karjal, es-formal - español (formal), bo - བོད་ཡིག, nso - Sesotho sa Leboa
kk-kz - қазақша (Қазақстан), btm - Batak Mandailing, cop - ϯⲙⲉⲧⲣⲉⲙⲛ̀ⲭⲏⲙⲓ
arn - mapudungun, kk-cn - قازاقشا (جۇنگو), als - Alemannisch, roa-tara - tarandíne
pnt - Ποντιακά, to - lea faka-Tonga, so - Soomaaliga, no - norsk, mo - молдовеняскэ
tpi - Tok Pisin, eml - emiliàn e rumagnòl, io - Ido, lo - ລາວ, ko - 한국어, fo - føroyskt
eo - Esperanto, map-bms - Basa Banyumasan, alt - алтай тил, csb - kaszëbsczi
anp - अंगिका, lrc - لۊری شومالی, yi - ייִדיש, hsb - hornjoserbsce
ase - American sign language, inh - гӀалгӀай, rn - ikirundi, sn - chiShona, tn - Setswana, mn - монгол
nn - norsk nynorsk, vro - võro, kn - ಕನ್ನಡ, ln - lingála, en - English, gn - Avañe'ẽ
nqo - ߒߞߏ, kk-tr - qazaqşa (Türkïya), am - አማርኛ, mhr - олык марий
diq - Zazaki, gom-deva - गोंयची कोंकणी, qug - Runa shimi
sm - Gagana Samoa, rm - rumantsch, nrm - Nouormand, om - Oromoo, nod - ᨣᩤᩴᨾᩮᩬᩥᨦ
km - ភាសាខ្មែរ, arc - ܐܪܡܝܐ, frc - français cadien, grc - Ἀρχαία ἑλληνικὴ
nan-latn-pehoeji - Bân-lâm-gú (Pe̍h-ōe-jī), hsn - 湘語, nov - Novial, crh-ro - tatarşa, aeb-latn - Tûnsî, yo - Yorùbá
vo - Volapük, new - नेपाल भाषा, sl - slovenščina, tl - Tagalog, chr - ᏣᎳᎩ
pl - polski, ml - മലയാളം, nl - Nederlands, kl - kalaallisut, vot - Vaďďa
isv-latn - medžuslovjansky, el - Ελληνικά, ku-arab - کوردی (عەرەبی), igl - Igala
shn - ၽႃႇသႃႇတႆး , egl - Emiliàn, bgn - روچ کپتین بلوچی, kge - Kumoring, chn - chinuk wawa
zh-cn - 中文(中国大陆), mos - moore, uz - oʻzbekcha / ўзбекча, bho - भोजपुरी
zgh - ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ, ik - Iñupiatun, zh-tw - 中文(臺灣), cbk-zam - Chavacano de Zamboanga
zh-sg - 中文(新加坡), zh-my - 中文(马来西亚), zh-mo - 中文(澳門), co - corsu
dz - ཇོང་ཁ, sei - Cmique Itom, zh-hans - 中文(简体), liv - Līvõ kēļ
hak-latn - Hak-kâ-ngî (Pha̍k-fa-sṳ), awa - अवधी, zu - isiZulu, zea - Zeêuws, yue-hans - 粵语(简体)
ty - reo tahiti, xsy - saisiyat, xmf - მარგალური, xh - isiXhosa, az - azərbaycanca
hif - Fiji Hindi, gor - Bahasa Hulontalo, wuu-hant - 吳語(正體), wuu - 吴语, wo - Wolof
de-formal - Deutsch (Sie-Form), war - Winaray, vmf - Mainfränkisch, my - မြန်မာဘာသာ, yue - 粵語
ky - кыргызча, vi - Tiếng Việt, vec - vèneto, hak - 客家語 / Hak-kâ-ngî, ve - Tshivenda
ny - Chi-Chewa, es - español, de-ch - Schweizer Hochdeutsch, cy - Cymraeg, uz-latn - oʻzbekcha
uz-cyrl - ўзбекча, hy - հայերեն, nap - Napulitano, fy - Frysk, olo - livvinkarjala
udm - удмурт, tet - tetun, uk - українська, ay - Aymar aru, ann - Obolo, ug-latn - Uyghurche
szy - Sakizaya, os - ирон, ug-arab - ئۇيغۇرچە, arq - جازايرية, knc - Yerwa Kanuri
ksh - Ripoarisch, lfn - Lingua Franca Nova, sms - nuõrttsääʹmǩiõll, sdh - کوردی خوارگ
hu-formal - magyar (formal), tyv - тыва дыл, vls - West-Vlams, wls - Fakaʻuvea, tw - Twi, lua - ciluba
ttj - Orutooro, bat-smg - žemaitėška, bto - Iriga Bicolano, cpx-hant - 莆仙語(繁體)
dua - Duálá, pfl - Pälzisch, tt-cyrl - татарча, da - dansk, hno - ہندکو, tr - Türkçe
tok - toki pona, sw - Kiswahili, ks-deva - कॉशुर
gom - गोंयची कोंकणी / Gõychi Konknni, rup - armãneashti, tig - ትግሬ, mni - ꯃꯤꯇꯩ ꯂꯣꯟ
ban-bali - ᬩᬲᬩᬮᬶ, th - ไทย, be-x-old - беларуская (тарашкевіца)
rue - русиньскый, gag - Gagauz, fa - فارسی, ka - ქართული, ia - interlingua
ami - Pangcah, gan-hant - 贛語(繁體), fvr - poor’íŋ belé’ŋ, pa - ਪੰਜਾਬੀ
simple - Simple English, tcy - ತುಳು, id - Bahasa Indonesia, mai - मैथिली
rmy - romani čhib, sv - svenska, su - Sunda, rw - Ikinyarwanda, srn - Sranantongo, dga - Dagaare
kw - kernowek, sro - sardu campidanesu, sr-el - srpski (latinica), iba - Jaku Iban
zh-hk - 中文(香港), bcl - Bikol Central, ro - română, hke - kihunde, ho - Hiri Motu, bci - wawle
bn - বাংলা, zh-hant - 中文(繁體), dsb - dolnoserbski, guw - gungbe, skr - سرائیکی
sje - bidumsámegiella, hz - Otsiherero, ike-cans - ᐃᓄᒃᑎᑐᑦ, kjp - ဖၠုံလိက်
gv - Gaelg, bm - bamanankan, loz - Silozi, jv - Jawa, cv - чӑвашла, dv - ދިވެހިބަސް
ks-arab - کٲشُر, roa-rup - armãneashti, got - 𐌲𐌿𐍄𐌹𐍃𐌺, lzz - Lazuri, lad - Ladino
sgs - žemaitėška, kv - коми, lv - latviešu, ilo - Ilokano, gld - на̄ни, kbp - Kabɩyɛ
din - Thuɔŋjäŋ, fat - mfantse, se - davvisámegiella, khw - کھوار, bew - Betawi, mt - Malti
sdc - Sassaresu, min - Minangkabau, bbc - Batak Toba, av - авар, bqi - بختیاری
aeb-arab - تونسي, ru - русский, ruq-latn - Vlăheşte, lus - Mizo ţawng, bug - Basa Ugi
iu - ᐃᓄᒃᑎᑐᑦ / inuktitut, hu - magyar, gu - ગુજરાતી, rsk - руски, eu - euskara, gl - galego
hil - Ilonggo, azb - تۆرکجه, qu - Runa Simi, rif - Tarifit, bbc-latn - Batak Toba
en-gb - British English, prg - prūsiskan, pms - Piemontèis, ku - kurdî, pi - पालि
nit - కొలామి, de-at - Österreichisches Deutsch, pdt - Plautdietsch, ku-latn - kurdî (latînî)
zh-yue - 粵語, st - Sesotho, tt - татарча / tatarça, niu - Niuē, fit - meänkieli, tay - Tayal
pap - Papiamentu, frr - Nordfriisk, cho - Chahta anumpa, sjd - кӣллт са̄мь кӣлл
nv - Diné bizaad, it - italiano, nog - ногайша, mi - Māori, ht - Kreyòl ayisyen, et - eesti
guc - wayuunaiki, bi - Bislama, cpx - 莆仙語 / Pó-sing-gṳ̂, mzn - مازِرونی, ii - ꆇꉙ
ms-arab - بهاس ملايو, pt - português, ang - Ænglisc, mrj - кырык мары, bjn - Banjar, lt - lietuvių
isv-cyrl - меджусловјанскы, mrh - Mara, blk - ပအိုဝ်ႏဘာႏသာႏ, ltg - latgaļu
fur - furlan, gur - farefare, lld - Ladin, krc - къарачай-малкъар
kk-cyrl - қазақша (кирил), gom-latn - Gõychi Konknni, kiu - Kırmancki, aln - Gegë
cu - словѣньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, avk - Kotava, cps - Capiceño, an - aragonés


Task 5 - Lua Libraries

uredi

substring and case

uredi

i

t's my life

IT'S MY LIFE

-- 8. Change the function p.sentence in your module sandbox so that it takes the first letter of the string supplied and turns it into a capital (this is called "sentence case"). You need to get the first letter and capitalise it, then get the rest of the string, and concatenate the two parts.

It's my life

pattern matching

uredi

Year = 2019
Day = 11
Month = november

Q1. What does %d+ match in a Lua pattern?

Get one or more digits

Q2. What does %w+ match in a Lua pattern?

get one or more words

-- 14. In a new paragraph in your user sandbox, write the pattern you would use to extract the day, month and year from an American-style date like "October 31, 2018".

Year = 2019
Day = 11
Month = november

Task 4 - Loops and tables

uredi

Tables

uredi

-- 13 double:

Hello, Dad, Mum
Hello, Uncle Stan, Aunty Elsie
Hello, Brian, Don Jr.
Hello, Eric

-- 13 single:
Hello, Dad
Hello, Mum
Hello, Uncle Stan
Hello, Aunty Elsie
Hello, Brian
Hello, Don Jr.
Hello, Eric

-- 13 no param:
Hello , Dad, Mum, Uncle Stan, Aunty Elsie, Brian, Don Jr., Eric

-- Hello Uncle Stan

iterations

uredi

{{#invoke:VitosmoCode|times}} -- {{#invoke:VitosmoCode|times|}} -- {{#invoke:VitosmoCode|times|num=" "}}

Times table 2
1 times 2 equals 2;2 times 2 equals 4;3 times 2 equals 6;4 times 2 equals 8
5 times 2 equals 10;6 times 2 equals 12;7 times 2 equals 14;8 times 2 equals 16
9 times 2 equals 18;10 times 2 equals 20;11 times 2 equals 22;12 times 2 equals 24


Times table 5
1 times 5 equals 5;2 times 5 equals 10;3 times 5 equals 15;4 times 5 equals 20
5 times 5 equals 25;6 times 5 equals 30;7 times 5 equals 35;8 times 5 equals 40
9 times 5 equals 45;10 times 5 equals 50;11 times 5 equals 55;12 times 5 equals 60

Task 3

uredi

15 degrees Celsius is 59 degrees Fahrenheit

25 degrees Celsius is 77 degrees Fahrenheit

0 degrees Celsius is 32 degrees Fahrenheit

________________________

3 degrees Celsius is 37.4 degrees Fahrenheit - it is cold

25 degrees Celsius is 77 degrees Fahrenheit - it is warm

0 degrees Celsius is 32 degrees Fahrenheit - it is cold

0 degrees Celsius is 32 degrees Fahrenheit - it is cold

Task 2

uredi

-https://en.wikipedia.org/wiki/User:RexxS/GCI-2018-Task02

Q1. Which letter is conventionally used in Scribunto modules to hold the table of functions?

A1. p

Q2. What keyword marks the start of a function definition?

A2. function

Q3. What keyword marks the end of a function definition?

A3.end

90% sure this is not correct. But then, I do not understand the context


Hello, world!

Hello from Lua to my friend Jimbo

Task 1

uredi

-https://en.wikipedia.org/wiki/User:RexxS/GCI-2018-Task01


Great Blue Heron and immature Bald Eagle on the Platte River.jpg

 

imgs

  NODES
ELIZA 3
languages 2
OOP 2
os 20
text 1