Module:AbilityBoxes: Difference between revisions
From Teriock
More actions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 18: | Line 18: | ||
-- Return the concatenated result | -- Return the concatenated result | ||
return table.concat(result) | return frame:preprocess(table.concat(result)) | ||
end | end | ||
return p | return p | ||
Latest revision as of 01:48, 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 frame:preprocess(table.concat(result))
end
return p