Модуль:Песочница/Pok: различия между версиями

Материал из Space Station 14 Вики
мНет описания правки
мНет описания правки
Строка 1: Строка 1:
local p = {}
local p = {}


if not _G.__call_counter then
function p.increment(frame)
     _G.__call_counter = 0
     local count = mw.getContentLanguage():getContentLanguage():getCode()
end


function p.increment(frame)
    local current_count = mw.getCache():get("call_counter_" .. count) or 0
     _G.__call_counter = _G.__call_counter + 1
 
     return "Модуль вызван " .. _G.__call_counter .. " раз(а) на этой странице."
     current_count = current_count + 1
 
    mw.getCache():set("call_counter_" .. count, current_count)
 
     return "Модуль вызван " .. current_count .. " раз(а) на этой странице."
end
end


return p
return p

Версия от 20:49, 3 февраля 2025

Для документации этого модуля может быть создана страница Модуль:Песочница/Pok/doc

local p = {}

function p.increment(frame)
    local count = mw.getContentLanguage():getContentLanguage():getCode()

    local current_count = mw.getCache():get("call_counter_" .. count) or 0

    current_count = current_count + 1

    mw.getCache():set("call_counter_" .. count, current_count)

    return "Модуль вызван " .. current_count .. " раз(а) на этой странице."
end

return p