Module:WikiList

local p = {}

function p._format( refList ) local root = mw.html.create( "div" ):addClass("t_wikilist") root :tag("div"):addClass("t_wikilist_head") :wikitext("Independent wikis with more information:") list_div = root:tag( "div" ):addClass("t_wikilist_body") for _, wikiData in pairs(refList) do		list_div:tag("span") :wikitext("[" .. wikiData.url .. " " .. wikiData.name .. " (" .. wikiData.lang .. ")] ")	end return tostring(root) end

function p.wikiList( frame ) local type = frame:getParent.args[1] local target = frame:getParent.args[2] or mw.title.getCurrentTitle.text local data = mw.ext.externalData.getExternalData { url = 'https://gamewikis.github.io/WikiLookup/WikiLookup.json', data = "json=__json" }	local refList = {} for _, wikiData in pairs(data["json"]) do		mw.logObject(wikiData[type]) if wikiData[type] ~= nil then for _, game in pairs(wikiData[type]) do				if game == target then table.insert(refList, { name = wikiData["name"], lang = wikiData["lang"], url = wikiData["homepage"]}) end end end end

if next(refList) == nil then return "" else return p._format( refList ) end end

return p