可在Module:Trait/doc创建此模块的帮助文档
local p = {} local getArgs = require('Module:Arguments').getArgs function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) for k in ipairs(args) do args[k] = args[k]:lower() end local traits = {} for k, v in ipairs(args) do traits[k] = mw.loadData('Module:Trait/list')[v] if not traits[k] then local s = "<span style=\"color: red; font-size: 11px;\">(unrecognized trait ID \"" .. args[k] .. "\" for [[Module:Trait]])</span>[[Category:Pages with unrecognized trait strings]]" if args.table then return "\n|\n" .. s else return s end end end local s = "" local indent = "" for i=1, (args.indent or 1), 1 do indent = indent .. "*" end for _, trait in ipairs(traits) do for _, v in ipairs(trait.stats) do s = s .. indent .. v .. "\n" end s = s .. "----\n" end --Remove horizontal line from the end of string s = s:sub(1, -7) if args.table then local n = "" for _, trait in ipairs(traits) do n = n .. trait.name .. "<br>" end --Remove <br> from the end of string n = n:sub(1, -5) s = n .. "\n|\n" .. s end return s end return p