From dddcd0c7a712c325f7ceb982a7adb754980db4d7 Mon Sep 17 00:00:00 2001 From: Rin Date: Sun, 22 Aug 2021 15:45:41 +0100 Subject: [PATCH] Fix a major bug. Also fix copy. yw milla --- funcs.lua | 8 +++++++- scene/gamemode_config.lua | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/funcs.lua b/funcs.lua index 5de574b..0eae64e 100644 --- a/funcs.lua +++ b/funcs.lua @@ -3,7 +3,13 @@ function copy(t) if type(t) ~= "table" then return t end local meta = getmetatable(t) local target = {} - for k, v in pairs(t) do target[k] = v end + for k, v in pairs(t) do + if type(v) == "table" then + target[k] = copy(v) + else + target[k] = v + end + end setmetatable(target, meta) return target end diff --git a/scene/gamemode_config.lua b/scene/gamemode_config.lua index 248a5ea..b2df526 100644 --- a/scene/gamemode_config.lua +++ b/scene/gamemode_config.lua @@ -12,6 +12,8 @@ function GamemodeConfigScene:new(gamemode) mode_config = gamemode:provideSettings() or {} optioncount = #mode_config + print(selected_mode.hash) + self.highlight = 1 for i, j in pairs(mode_config) do @@ -25,7 +27,7 @@ function GamemodeConfigScene:new(gamemode) end function GamemodeConfigScene:save() - config.gamemodesettings[selected_mode.hash] = new_config + config.gamemodesettings[selected_mode.hash] = copy(new_config) end function GamemodeConfigScene:render()