Fix a major bug. Also fix copy. yw milla

This commit is contained in:
Rin 2021-08-22 15:45:41 +01:00
parent d38954dd69
commit dddcd0c7a7
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

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