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()