Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:AbilityBoxes: Difference between revisions

From Teriock
Content deleted Content added
// via Wikitext Extension for VSCode
Tag: Reverted
// via Wikitext Extension for VSCode
Tag: Manual revert
Line 14: Line 14:
local result = {}
local result = {}
for _, ability in ipairs(abilities) do
for _, ability in ipairs(abilities) do
table.insert(result, "{{AbilityBox|Ability:" .. ability .. "}}\n")
table.insert(result, "{{AbilityBox|Ability:" .. ability .. "}}")
end
end

Revision as of 01:46, 13 January 2025

Documentation for this module may be created at Module:AbilityBoxes/doc

local p = {}

function p.parse(frame)
    -- Get the input from the first argument passed to the module
    local input = frame.args[1] or ""
    
    -- Split the input string by commas
    local abilities = {}
    for ability in string.gmatch(input, "([^,]+)") do
        table.insert(abilities, ability:match("^%s*(.-)%s*$")) -- Trim whitespace
    end
    
    -- Wrap each ability in the AbilityBox template
    local result = {}
    for _, ability in ipairs(abilities) do
        table.insert(result, "{{AbilityBox|Ability:" .. ability .. "}}")
    end
    
    -- Return the concatenated result
    return table.concat(result)
end

return p