模块:Utils
可在模块:Utils/doc创建此模块的帮助文档
local p = {} function p.foreach(frame) local template = frame.args[1] template = template:gsub('\\n', '\n') template = template:gsub('%(%(!%)%)', '|') local ret = '' for i, arg in ipairs(frame.args) do if i > 1 and arg ~= '' then local text = template:gsub('%(%(%(1%)%)%)', arg) ret = ret .. text end end return ret end function p.d() local frame = { args = { '((!))hello (((1)))\n', 'x', 'y', 'z' } } local r = p.foreach(frame) mw.log(r) end return p