跳转到内容
打开/关闭菜单
  • 450 条目
  • 804 文件
  • 22 用户
  • 9052 编辑
Blockland Wiki
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:GlitchText

来自Blockland Wiki
KK​(留言 | 贡献)2026年10月22日 (四) 12:13的版本 (创建页面,内容为“ local p = {} local glyphs = { "▓", "▒", "░", "█", "╳", "╱", "╲", "Ж", "Ψ", "※", "¤", "§", "ø", "þ", "æ", "µ", "∴", "∵", "⌁", "⌘", "⍉", "⟁", "⧖", "⨳", "⫷", "⫸", "0", "1", "7", "x", "_", "∿", "⌬", "⟊" } function p.main(frame) local text = frame.args.text or "" local i = 0 local output = mw.ustring.gsub( text, "[^\r\n]", function() i = i + 1…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:GlitchText/doc创建


local p = {}

local glyphs = {
    "▓", "▒", "░", "█", "╳", "╱", "╲",
    "Ж", "Ψ", "※", "¤", "§", "ø", "þ",
    "æ", "µ", "∴", "∵", "⌁", "⌘", "⍉",
    "⟁", "⧖", "⨳", "⫷", "⫸", "0", "1",
    "7", "x", "_", "∿", "⌬", "⟊"
}

function p.main(frame)
    local text = frame.args.text or ""
    local i = 0

    local output = mw.ustring.gsub(
        text,
        "[^\r\n]",
        function()
            i = i + 1

            -- 根据原文和字符位置生成稳定的伪随机乱码
            local hash = mw.hash.hashValue(
                "sha256",
                text .. ":" .. i
            )

            local n = tonumber(
                string.sub(hash, 1, 8),
                16
            ) or i

            return glyphs[(n % #glyphs) + 1]
        end
    )

    return output
end

return p