Module:SampleModule
Documentation for this module may be created at Module:SampleModule/doc
local p = {}
function p.main(frame)
-- Get arguments passed to the module
local args = frame.args
local parentArgs = frame:getParent() and frame:getParent().args or {}
-- Log the arguments for debugging
mw.log("frame.args:")
mw.logObject(args)
mw.log("frame:getParent().args:")
mw.logObject(parentArgs)
-- Generate output for testing
local output = {}
output[#output + 1] = "Arguments passed directly to this module (frame.args):"
for k, v in pairs(args) do
output[#output + 1] = string.format(" %s = %s", k, v)
end
output[#output + 1] = ""
output[#output + 1] = "Arguments passed to the parent template (frame:getParent().args):"
for k, v in pairs(parentArgs) do
output[#output + 1] = string.format(" %s = %s", k, v)
end
return table.concat(output, "\n")
end
return p