Bürokraten, Oberflächenadministratoren, SMW-Administratoren, SMW-Kuratoren, SMW-Editoren, Oversighter, Administratoren, Widget-Bearbeiter
215.199
Bearbeitungen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 95: | Zeile 95: | ||
end | end | ||
function tableToString(tbl, indent) | |||
-- Prints a LUA-Table as string. Very useful if you want to see whats inside | |||
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 | |||
return p | return p | ||
Bearbeitungen