local cfg_data = {
bools = { --switch / combobox / selectable here
visualsvis,indicatorsenabled, enable_scope, enable_antiaim,enable_builder, Ar, aspect_slider, trashtalking, switchsz, manual_yaw_base, offset_scope, length_scope, manual_yaw_base, condition, enable, left_yaw_add, right_yaw_add, modifier_offset, options, right_limit, left_limit, desync_freestanding, on_shot, lby_mode,
},
colors = { --color pickers here
col_1_scope
}
}
tab:button(ui.get_icon 'file-export' .. " Export config", function()
local Code = {{}, {}}
for _, bools in pairs(cfg_data.bools) do
table.insert(Code[1], bools:get())
end
for _, colors in pairs(cfg_data.colors) do
local col = colors:get()
table.insert(Code[2], string.format('%02X%02X%02X%02X', math.floor(col.r), math.floor(col.g), math.floor(col.b), math.floor(col.a)))
end
clipboard.set(base64.encode(JSON.stringify(Code)))
common.add_notify("Config system", "\a62FF6CFFConfig successfully exported!")
end)
function import(cfg)
local status, config = pcall(function() return JSON.parse(base64.decode(cfg)) end)
if not status or status == nil then
common.add_notify("Config system", "\aFF6262FFAn error occurred while importing!")
return end
for k, v in pairs(config) do
k = ({[1] = "bools", [2] = "colors"})[k]
for k2, v2 in pairs(v) do
if (k == "bools") then
cfg_data[k][k2]:set(v2)
end
if (k == "colors") then
cfg_data[k][k2]:set(color(tonumber('0x'..v2:sub(1,2)), tonumber('0x'..v2:sub(3,4)), tonumber('0x'..v2:sub(5, 6)), tonumber('0x'..v2:sub(7,8))))
end
end
end
common.add_notify("Config system", "\a62FF6CFFConfig successfully imported!")
end