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

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


function p.info()
function p.increment(frame)
     local engine = _G['jit'] and "LuaJIT (luastandalone)" or "LuaSandbox"
     local content = mw.title.getCurrentTitle():getContent()
     return "'''Lua Engine:''' " .. engine
    local currentCount = tonumber(content:match('<!--callCount:(%d+)-->')) or 0
    local newCount = currentCount + 1
     mw.title.getCurrentTitle():edit(content .. '\n<!--callCount:' .. newCount .. '-->')
    return "Количество вызовов: " .. newCount
end
end


return p
return p

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

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

local p = {}

function p.increment(frame)
    local content = mw.title.getCurrentTitle():getContent()
    local currentCount = tonumber(content:match('<!--callCount:(%d+)-->')) or 0
    local newCount = currentCount + 1
    mw.title.getCurrentTitle():edit(content .. '\n<!--callCount:' .. newCount .. '-->')
    return "Количество вызовов: " .. newCount
end

return p