Module:Sandbox/Desb42
Appearance
local p = {}
function p.siteinfo(frame)
return mw.site.siteName .. '--' .. '(' .. mw.site.server .. ')'
end
local dump_table_count = 0;
local function dump_table(o)
if dump_table_count == 10 then
return "overflow";
end
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) == 'table' then
k = dump_table(k)
elseif type(k) ~= 'number' then
k = '"'..k..'"'
end
dump_table_count = dump_table_count + 1;
s = s .. '['..k..'] = ' .. dump_table(v) .. ','
dump_table_count = dump_table_count - 1;
end
return s .. '} '
else
return tostring(o)
end
end
local diagnostic_preprocess_nested_data = ''
function mw.diagnostic_preprocess_nested(o)
if o == 'clear' then
diagnostic_preprocess_nested_data = ''
elseif o == 'exec' then
diagnostic_preprocess_nested_data = diagnostic_preprocess_nested_data .. 'once';
end
return diagnostic_preprocess_nested_data
end
function p.info(frame)
mw.logObject(frame)
return dump_table(frame)
end
return p