Module:MultiRequire

require('Module:LibraryUtil')

local function formatError(e, module) if type(e) ~= 'string' then return nil end if e:match('not found') then return ('Module %q was not found'):format(module) elseif e:match('loop') then return ('Loop or previous error loading module %q'):format(module) elseif e:match('^Module:') then return ('Exception in loading module %q at line %s: %s'):format(module, e:match('^Module:%w+:(%d+)'), e:gsub('^Module:%w+:%d+:%s*', '')) end end

return function(...) local v = checkArgs({ { 'string', 'table' } }, ...) local tp = type(v) local ret = {} if tp == 'string' then for i, module in forEachArgs('string', ...) do 			local success, res = pcall(require, module) assertTrue(success, formatError(res, module), 2) table.insert(ret, res) end else for i, module in ipairs(v) do			local success, res = pcall(require, module) assertTrue(sucess, formatError(res, module), 2)

table.insert(ret, res) end end if tp == 'string' then return unpack(ret) else return ret end end