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

Полностью удалено содержимое страницы
Метка: очистка
Нет описания правки
Строка 1: Строка 1:
local p = {}


local STORE = {}
local function curKey()
    local t = mw.title.getCurrentTitle()
    if not t then return nil end
    return t.prefixedText
end
function p.set(frame)
    local args = frame and frame.args or {}
    local path = args.path or args[1] or args.base or ""
    path = mw.text.trim(tostring(path or ""))
    if path == "" then return "" end
    local key = curKey()
    if not key then return "" end
    STORE[key] = path
    return ""
end
function p.get(frame)
    local key = curKey()
    if not key then return nil end
    return STORE[key]
end
function p.clear(frame)
    local key = curKey()
    if key then STORE[key] = nil end
    return ""
end
return p