Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Jan 30, 2012 9:27 pm |
This was a fun one ;) Edit: made it a bit more readable.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="printgmcp" language="Lua">
<value>local gmcp = zs.sys.gmcp
local out = ""
local function procitem(key, data, depth)
out = out .. string.rep(" ", depth * 3) .. key .. ": "
if type(data) == "table" then
out = out .. "{\n"
for k, v in pairs(data) do procitem(k, v, depth + 1) end
out = out .. string.rep(" ", depth * 3) .. "}\n"
else
out = out .. data .. "\n"
end
end
procitem("gmcp", gmcp, 0)
print(out)</value>
</alias>
</cmud> |
|
|