Module:ModDisplay
Jump to navigation
Jump to search
local p = {}
local cargo = mw.ext.cargo
function p.main(frame)
local rawmodlist = frame
if frame.args ~= nil then
rawmodlist = frame.args[1]
end
local modlist = ""
local table = 'Mods'
local fields = 'DisplayName'
--separate the mods into an array...
rawmodlist = rawmodlist:gsub('</br>', '&')
for mod in rawmodlist:gmatch('%s*(%w+)%s*&?') do
local result = cargo.query(table, fields, {where='_pageNamespace="0" AND _pageName="'.. mod ..'"'})
if not next(result) then
return
else
modlist = modlist .. result[1]['DisplayName'] .. " "
end
end
return (modlist)
end
return p