Module:ItemEffect
From He is Coming Official Wiki
Documentation for this module may be created at Module:ItemEffect/doc
local p = {}
-- Require your existing ColorText module
local color = require("He_is_Coming/ColorText")
-- Fetch the 'effect' parameter from the Infobox template of an item
function p.main(frame)
local itemName = frame.args[1] or ""
if itemName == "" then
return "Error: no item specified"
end
-- Build the template frame name
local templateName = "Template:" .. itemName
local templateFrame = mw.getContentFrame(templateName)
if not templateFrame then
return "Error: item page or template not found"
end
-- Attempt to get the 'effect' parameter from the template
local effectText = templateFrame:getParameter("effect") or ""
if effectText == "" then
return "Effect not found on item page"
end
-- Pass effect text to ColorText for keyword highlighting
return color.main({ args = { effectText } })
end
return p


