Created
December 3, 2022 21:46
-
-
Save Wolf480pl/857b8a299bff35348929ba374c652011 to your computer and use it in GitHub Desktop.
dump dynamic wireplumber 0.4 config - place in main.lua.d or similar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_json(v) | |
function to_lines(x) | |
if type(x) ~= "table" then | |
return {"\"" .. tostring(x) .. "\""} | |
end | |
local ret = {"{"} | |
local comma = "" | |
for k, v in pairs(x) do | |
local s = to_lines(v) | |
table.insert(ret, comma .. "\"" .. tostring(k) .. "\": " .. s[1]) | |
table.remove(s, 1) | |
for _, l in ipairs(s) do | |
table.insert(ret, " " .. l) | |
end | |
comma = ", " | |
end | |
table.insert(ret, "}") | |
return ret | |
end | |
local ret = "" | |
for _, l in ipairs(to_lines(v)) do | |
ret = ret .. l .. "\n" | |
end | |
return ret | |
end | |
print("---- BEGIN JSON main.lua.d ---- ") | |
print(to_json(components)) | |
print("---- END JSON ---- ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment