Die Dokumentation für dieses Modul kann unter Modul:Stadtwikis/Doku erstellt werden

local p = {}
--local c = require( "Module:Common" )

function tableToString(tbl, indent)
    indent = indent or 0
    local toprint = string.rep(" ", indent) .. "{\n"
    indent = indent + 2
    for k, v in pairs(tbl) do
        toprint = toprint .. string.rep(" ", indent)
        if type(k) == "number" then
            toprint = toprint .. "[" .. k .. "] = "
        elseif type(k) == "string" then
            toprint = toprint .. k .. " = "
        end
        if type(v) == "number" then
            toprint = toprint .. v .. ",\n"
        elseif type(v) == "string" then
            toprint = toprint .. "\"" .. v .. "\",\n"
        elseif type(v) == "table" then
            toprint = toprint .. tableToString(v, indent + 2) .. ",\n"
        else
            toprint = toprint .. "\"" .. tostring(v) .. "\",\n"
        end
    end
    toprint = toprint .. string.rep(" ", indent - 2) .. "}"
    return toprint
end

function p.Versuch(frame)
	--pf = frame:getParent()
	--args = pf.args
	--url = frame.args.url or ""
	--e,t=mw.ext.externaldata.getWebData {
    --    url = "https://www.fuerthwiki.de/wiki/api.php?action=query&meta=siteinfo&siprop=statistics&format=json;",
    --    extract = "*", 
    --    format = "json"}
	--data, errors = mw.ext.externalData.getExternalData('https://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&format=json')
    --json = not errors and data.__json or false
    
    --t=mw.ext.externaldata.getWebData {"https://www.fuerthwiki.de/wiki/api.php?action=query&meta=siteinfo&siprop=statistics&format=json",
   -- 	extract="*",
   -- 	format="json"
    --}
    data, errors = mw.ext.externalData.getExternalData {'https://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&format=json'}
	json = not errors and data.__json or false
	return json, tableToString(errors)
end

return p