Module:交叉阴影

W​(留言 | 贡献)2023年4月1日 (六) 19:43的版本 (创建页面,内容为“-- Module:交叉阴影 -- Made with ♥ by User:Leranjun -- This module implements {{tl|交叉阴影}}. -- Please refrain from invoking this module directly. local p = {} local getArgs = require("Module:Arguments").getArgs function p.main(frame) return p._main(getArgs(frame), frame) end function p._main(args, frame) frame = frame or mw.getCurrentFrame() local colors = { [0] = { args.c2, args.s2 },…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在Module:交叉阴影/doc创建

-- Module:交叉阴影
-- Made with ♥ by User:Leranjun

-- This module implements {{tl|交叉阴影}}.
-- Please refrain from invoking this module directly.

local p = {}

local getArgs = require("Module:Arguments").getArgs

function p.main(frame)
    return p._main(getArgs(frame), frame)
end

function p._main(args, frame)
    frame = frame or mw.getCurrentFrame()
    local colors = {
        [0] = {
            args.c2,
            args.s2
        },
        [1] = {
            args.c1,
            args.s1
        }
    }
    local r = ""
    local i = 1
    while (args[i]) do
        r =
            r ..
            frame:expandTemplate {
                title = "Font",
                args = {frame:preprocess(args[i]), color = colors[i % 2][1], shadowcolor = colors[i % 2][2]}
            }
        i = i + 1
    end

    return r
end

return p