Module:Sandbox/LVL: Difference between revisionsGive feedback
Jump to navigation
Jump to search
No edit summary |
Replaced content with "local p = {} local Icon = require('Module:Icon') function p.parse(frame) local input = frame.args[1] or "" local size = frame.args[2] or "25px" if input == "" then return "" end local result = {} -- Split by comma for hero in string.gmatch(input, '([^,]+)') do -- Trim whitespace hero = hero:match("^%s*(.-)%s*$") -- Generate the icon using the existing module logic -- We fake a frame to pass to the ex..." Tag: Replaced |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local | local Icon = require('Module:Icon') | ||
function p.parse(frame) | |||
local input = frame.args[1] or "" | |||
local size = frame.args[2] or "25px" | |||
function p. | |||
local | |||
local | |||
if input == "" then return "" end | |||
if | |||
local result = {} | |||
return " | -- Split by comma | ||
for hero in string.gmatch(input, '([^,]+)') do | |||
-- Trim whitespace | |||
hero = hero:match("^%s*(.-)%s*$") | |||
-- Generate the icon using the existing module logic | |||
-- We fake a frame to pass to the existing Icon module | |||
local fakeFrame = { getParent = function() return { args = { hero, size, "icon-only" } } end } | |||
table.insert(result, Icon.render(fakeFrame)) | |||
end | end | ||
return table.concat(result, " ") | |||
end | end | ||
return p | return p | ||
Revision as of 17:58, 27 November 2025
Documentation for this module may be created at Module:Sandbox/LVL/doc
local p = {}
local Icon = require('Module:Icon')
function p.parse(frame)
local input = frame.args[1] or ""
local size = frame.args[2] or "25px"
if input == "" then return "" end
local result = {}
-- Split by comma
for hero in string.gmatch(input, '([^,]+)') do
-- Trim whitespace
hero = hero:match("^%s*(.-)%s*$")
-- Generate the icon using the existing module logic
-- We fake a frame to pass to the existing Icon module
local fakeFrame = { getParent = function() return { args = { hero, size, "icon-only" } } end }
table.insert(result, Icon.render(fakeFrame))
end
return table.concat(result, " ")
end
return p