Skip to content

Instantly share code, notes, and snippets.

@cedricduriau
Last active March 18, 2021 12:42
Show Gist options
  • Save cedricduriau/4751d9f8ab0c556e214de6db2eb3d517 to your computer and use it in GitHub Desktop.
Save cedricduriau/4751d9f8ab0c556e214de6db2eb3d517 to your computer and use it in GitHub Desktop.
Fusion Comp Script to dump all registry attributes into a json file.
local json = require("dkjson")
function get_registry_info()
local data = {}
for _i, registry in ipairs(fusion:GetRegList()) do
data[registry.ID] = {}
for k, v in pairs(fusion:GetRegAttrs(registry.ID)) do
table.insert(data[registry.ID], k)
end
end
return data
end
function write_json(data, path)
local file = io.open(path, "w")
local json_str = json.encode(data, {indent=true})
file:write(json_str)
file:close()
end
local path = string.format("%s_%s", os.tmpname(), "reg_attrs.json")
local reg_attrs = get_registry_info()
write_json(reg_attrs, path)
print(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment