Module:Soreness: Difference between revisions
From Growtopia
Jump to navigationJump to search
>Sorenesss No edit summary |
>Sorenesss No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p.test(frame) | function p.test(frame) | ||
-- Ensure 'class' is initialized as a table | |||
local class = {} | |||
return "<span class='"..table.concat(class," ").."'>".. | table.insert(class, "growsprite") | ||
-- Get the input argument | |||
local input = frame.args[1] or "" | |||
-- Extract the src attribute from the input argument | |||
local src = input:match('src="([^"]+)"') | |||
if not src then | |||
return "Error: Unable to find 'src' in the input." | |||
end | |||
-- Construct the desired <img> tag | |||
local imgTag = '<img src="' .. src .. '" alt="Generated Image">' | |||
-- Construct the final output with the growsprite span | |||
return "<span class='" .. table.concat(class, " ") .. "'>" .. imgTag .. "</span>[[Category:AutoPurge]]" | |||
end | end | ||
return p | return p | ||
Revision as of 12:02, 20 November 2024
Documentation for this module may be created at Module:Soreness/doc
local p = {}
function p.test(frame)
-- Ensure 'class' is initialized as a table
local class = {}
table.insert(class, "growsprite")
-- Get the input argument
local input = frame.args[1] or ""
-- Extract the src attribute from the input argument
local src = input:match('src="([^"]+)"')
if not src then
return "Error: Unable to find 'src' in the input."
end
-- Construct the desired <img> tag
local imgTag = '<img src="' .. src .. '" alt="Generated Image">'
-- Construct the final output with the growsprite span
return "<span class='" .. table.concat(class, " ") .. "'>" .. imgTag .. "</span>[[Category:AutoPurge]]"
end
return p