Module:Sandbox/Aurelain/Patch

From Heroes of Might and Magic: Olden Era Official Wiki
Revision as of 06:26, 7 October 2026 by Aurelain (talk | contribs) (Created page with "local p = {} -- Displays a variable ------------------------------------------------------------------------------------------------------------------------ local function dump(target) return '<pre>' .. mw.dumpObject(target) .. '</pre>' end -- ------------------------------------------------------------------------------------------------------------------------ function p.renderLink(frame) local args = frame.args local id = args.id or '' local lang = a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This module provides helpful functions for the rendering of a Template:Patch/row.

1. renderLink():

Input: Output:
{{#invoke:Sandbox/Aurelain/Patch|renderLink
    | id = skill_sorcery
    | lang = en
    | field = foo
}}
table#1 {
    ["args"] = table#2 {
        metatable = table#3
        ["field"] = "foo",
        ["id"] = "skill_sorcery",
        ["lang"] = "en",
    },
    ["argumentPairs"] = function#1,
    ["callParserFunction"] = function#2,
    ["expandTemplate"] = function#3,
    ["extensionTag"] = function#4,
    ["getArgument"] = function#5,
    ["getParent"] = function#6,
    ["getTitle"] = function#7,
    ["newChild"] = function#8,
    ["newParserValue"] = function#9,
    ["newTemplateParserValue"] = function#10,
    ["preprocess"] = function#11,
}
{{#invoke:Sandbox/Aurelain/Patch|renderLink
    | id = skill_sorcery
    | lang = en
    | field = skill_level_2_description
}}
table#1 {
    ["args"] = table#2 {
        metatable = table#3
        ["field"] = "skill_level_2_description",
        ["id"] = "skill_sorcery",
        ["lang"] = "en",
    },
    ["argumentPairs"] = function#1,
    ["callParserFunction"] = function#2,
    ["expandTemplate"] = function#3,
    ["extensionTag"] = function#4,
    ["getArgument"] = function#5,
    ["getParent"] = function#6,
    ["getTitle"] = function#7,
    ["newChild"] = function#8,
    ["newParserValue"] = function#9,
    ["newTemplateParserValue"] = function#10,
    ["preprocess"] = function#11,
}
{{#invoke:Sandbox/Aurelain/Patch|renderLink
    | id = dungeon_hero_11
    | lang = en
}}
table#1 {
    ["args"] = table#2 {
        metatable = table#3
        ["id"] = "dungeon_hero_11",
        ["lang"] = "en",
    },
    ["argumentPairs"] = function#1,
    ["callParserFunction"] = function#2,
    ["expandTemplate"] = function#3,
    ["extensionTag"] = function#4,
    ["getArgument"] = function#5,
    ["getParent"] = function#6,
    ["getTitle"] = function#7,
    ["newChild"] = function#8,
    ["newParserValue"] = function#9,
    ["newTemplateParserValue"] = function#10,
    ["preprocess"] = function#11,
}


2. renderText():

Input: Output:
{{#invoke:Sandbox/Aurelain/Patch|renderLink
            | field = skill_description
            | summary = +❮10▸20❯% Magic Damage dealt.
        }}
table#1 {
    ["args"] = table#2 {
        metatable = table#3
        ["field"] = "skill_description",
        ["summary"] = "+❮10▸20❯% Magic Damage dealt.",
    },
    ["argumentPairs"] = function#1,
    ["callParserFunction"] = function#2,
    ["expandTemplate"] = function#3,
    ["extensionTag"] = function#4,
    ["getArgument"] = function#5,
    ["getParent"] = function#6,
    ["getTitle"] = function#7,
    ["newChild"] = function#8,
    ["newParserValue"] = function#9,
    ["newTemplateParserValue"] = function#10,
    ["preprocess"] = function#11,
}

local p = {}

-- Displays a variable
------------------------------------------------------------------------------------------------------------------------
local function dump(target)
    return '<pre>' .. mw.dumpObject(target) .. '</pre>'
end

--
------------------------------------------------------------------------------------------------------------------------
function p.renderLink(frame)
    local args = frame.args
    local id = args.id or ''
    local lang = args.lang or ''
    local field = args.field or ''
    return dump(frame)
end

--
------------------------------------------------------------------------------------------------------------------------
function p.renderText(frame)
    local args = frame.args
    local field = args.field or ''
    local summary = args.summary or ''
    return dump(frame)
end

return p