Modul:ArtikelDesTages: Unterschied zwischen den Versionen

Aus LASK Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 2: Zeile 2:


local artikel = {
local artikel = {
"Saison 2017/18",
    "Saison 2017/18",
"Saison 2018/19",
    "Saison 2018/19",
     "Saison 2019/20",
     "Saison 2019/20",
     "Saison 2020/21",
     "Saison 2020/21",
Zeile 21: Zeile 21:
     local jahr = tonumber(frame:preprocess("{{CURRENTYEAR}}"))
     local jahr = tonumber(frame:preprocess("{{CURRENTYEAR}}"))


     local wert = jahr * 10000 + monat * 100 + tag
     local datum = jahr * 10000 + monat * 100 + tag


     local index = (wert % #artikel) + 1
    local seed = (datum * 1103515245 + 12345) % 2147483648
 
     local index = (seed % #artikel) + 1
 
    local gestern = datum - 1
    local seedGestern = (gestern * 1103515245 + 12345) % 2147483648
    local indexGestern = (seedGestern % #artikel) + 1
 
    if index == indexGestern then
        index = (index % #artikel) + 1
    end


     local titel = artikel[index]
     local titel = artikel[index]

Aktuelle Version vom 6. September 2026, 17:09 Uhr

Die Dokumentation für dieses Modul kann unter Modul:ArtikelDesTages/Doku erstellt werden

local p = {}

local artikel = {
    "Saison 2017/18",
    "Saison 2018/19",
    "Saison 2019/20",
    "Saison 2020/21",
    "Saison 2021/22",
    "Saison 2022/23",
    "Saison 2023/24",
    "Saison 2024/25",
    "Saison 2025/26",
    "ÖFB-Cup Finale 2026",
    "LASK vs Celtic Glasgow (5:4 2026)"
}

function p.main(frame)

    local tag = tonumber(frame:preprocess("{{CURRENTDAY}}"))
    local monat = tonumber(frame:preprocess("{{CURRENTMONTH}}"))
    local jahr = tonumber(frame:preprocess("{{CURRENTYEAR}}"))

    local datum = jahr * 10000 + monat * 100 + tag

    local seed = (datum * 1103515245 + 12345) % 2147483648

    local index = (seed % #artikel) + 1

    local gestern = datum - 1
    local seedGestern = (gestern * 1103515245 + 12345) % 2147483648
    local indexGestern = (seedGestern % #artikel) + 1

    if index == indexGestern then
        index = (index % #artikel) + 1
    end

    local titel = artikel[index]

    return "[[" .. titel .. "|" .. titel .. "]]"
end

return p