Untitled
unknown
lua
3 years ago
1.0 kB
7
Indexable
local obj = get_device_model_data()
for k, v in pairs(obj) do
for i, j in pairs(v) do
local tmp_table = {}
local default_value
local zap_path
for zap_path, z in pairs(j) do
for str in string.gmatch(zap_path, "[^%/]+") do
table.insert(tmp_table, str)
end
if (z.type == "integer" and z.intDefault) then
default_value = z.intDefault
elseif (z.type == "string" and z.stringDefault) then
default_value = z.stringDefault
elseif (z.type == "boolean" and z.booleanDefault) then
default_value = z.booleanDefault
end
local module_reference = tmp_table[2]
local event_path = "/profiles/profile_set[creator='factory']/profile[ref='" .. module_reference .."']/" .. zap_path
print(module_reference)
print(event_path)
--print(default_value)
local res, err = data_transact.data_edit_atomic(data_root, event_path, 'patch', default_value )
assert(res or ( err:find'not found'), err )
end
end
endEditor is loading...