Bürokraten, Oberflächenadministratoren, SMW-Administratoren, SMW-Kuratoren, SMW-Editoren, Oversighter, Administratoren, Widget-Bearbeiter
215.197
Bearbeitungen
Keine Bearbeitungszusammenfassung Markierung: Manuelle Zurücksetzung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
--local c = require( "Module:Common" ) | --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) | function p.Versuch(frame) | ||
| Zeile 19: | Zeile 44: | ||
data, errors = mw.ext.externalData.getExternalData {'https://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&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 | json = not errors and data.__json or false | ||
return json, errors | return json, tableToString(errors) | ||
end | end | ||
return p | return p | ||
Bearbeitungen