模組:沙盒/一位史蒂夫/Signature

维基百科,自由的百科全书
文档图示 模块文档[创建]
local p = {}--[[
此模块将用于个人签名。
--]]
 
local function notempty(s)
    return (s and s ~= "")
end
 
function p.main(frame)
    if (notempty(frame.args["link"])) then
        local r = "[[:" .. frame.args["link"] .. '|<span style="color:#30D5C8">'
        if (notempty(frame.args["text"])) then
            r = r .. frame.args["text"]
        else
            r = r .. frame.args["link"]
        end
        return r .. "</span>]]"
    end
 
    local items = {
        {
            "虛擬YouTuber",
            "单推人"
        },
        {
            "WP:AUTOCONFIRM",
            "低级自确"
        },
        {
            "東方Project",
            "东方众"
        },
        {
            "芳文社",
            "芳文厨"
        }
    }
 
    math.randomseed(tostring(os.time()):reverse():sub(1, 4))
    local rand = math.random(#items)
 
    return "[[:" ..
        items[rand][1] .. '|<span style="color:#30D5C8">' .. (items[rand][2] or items[rand][1]) .. "</span>]]"
end
 
return p