Module:ModDisplay: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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 =...") |
mNo edit summary |
||
Line 20: | Line 20: | ||
return | return | ||
else | else | ||
modlist = modlist .. result[1]['DisplayName'] .. " " | |||
modlist = modlist .. result[1]['DisplayName'] | |||
end | end | ||
end | end |
Latest revision as of 20:19, 27 October 2019
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