mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-10-28 14:40:52 +00:00
refactor: replace table.foreach with recursive deep copy functions for config defaults
This commit is contained in:
+12
-4
@@ -234,10 +234,18 @@ end
|
||||
-- HealBot_Options_Defaults_OnClick: UI handler for OnClick options panel.
|
||||
function HealBot_Options_Defaults_OnClick(this)
|
||||
HealBot_Options_CastNotify_OnClick(nil,0);
|
||||
-- HealBot_Config = HealBot_ConfigDefaults;
|
||||
table.foreach(HealBot_ConfigDefaults, function (key,val)
|
||||
HealBot_Config[key] = val;
|
||||
end);
|
||||
HealBot_Config = {}
|
||||
local function DeepCopy(src, dest)
|
||||
for k, v in pairs(src) do
|
||||
if type(v) == "table" then
|
||||
dest[k] = {}
|
||||
DeepCopy(v, dest[k])
|
||||
else
|
||||
dest[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
DeepCopy(HealBot_ConfigDefaults, HealBot_Config)
|
||||
HealBot_Options_OnShow(HealBot_Options);
|
||||
HealBot_RecalcSpells();
|
||||
HealBot_Action_Reset();
|
||||
|
||||
Reference in New Issue
Block a user