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

м Содержимое страницы заменено на «local p = {} function p.count(frame) local page = frame.args[1] local word = frame.args[2] local title = mw.title.new(page) if not title then return "Страница не найдена" end local text = title:getContent() or "" local _, count = text:gsub("%f[%w]" .. word .. "%f[%W]", "") return count end return p»
Метка: замена
Полностью удалено содержимое страницы
Метка: очистка
 
(не показано 29 промежуточных версий этого же участника)
Строка 1: Строка 1:
local p = {}


function p.count(frame)
    local page = frame.args[1]
    local word = frame.args[2]
    local title = mw.title.new(page)
    if not title then
        return "Страница не найдена"
    end
    local text = title:getContent() or ""
    local _, count = text:gsub("%f[%w]" .. word .. "%f[%W]", "")
    return count
end
return p