跳转到内容

模块:Test

来自SS唯基
攸萨留言 | 贡献2025年9月13日 (六) 00:07的版本

Documentation icon 模块文档 [-查看-] [编辑] [历史] [刷新]

这个模块是干什么用的?

该模块用于测试,测试完请清空模块内的内容

基本用法

local p = {}

function p.函数名()
return '返回内容'
end

function p.函数名2()
return '返回内容2'
end

return

以上为最基本的用法,其他请自行学习Lua语言

其他

同样也有一个用于测试模板的模板,点这里进入


local p = {}

function p.paginate(frame)
    -- 获取参数
    local pages = frame.args.pages or ""
    local pageList = mw.text.split(pages, ",")
    local output = ""

    -- 生成分页内容
    for i, page in ipairs(pageList) do
        output = output .. string.format("[[User:%s|%s]]", page, page)
        if i < #pageList then
            output = output .. " | "  -- 添加分隔符
        end
    end

    return output
end

return p