mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 01:57:34 +00:00
fix the config update
This commit is contained in:
parent
0ccd2f3b1b
commit
7205dbe74a
|
@ -15,14 +15,14 @@ gmInte.config = gmInte.config || {}
|
||||||
if (SERVER) then
|
if (SERVER) then
|
||||||
RunConsoleCommand("sv_hibernate_think", "1")
|
RunConsoleCommand("sv_hibernate_think", "1")
|
||||||
|
|
||||||
if (file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/config.json", "DATA"))) then
|
if (!file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/config.json", "DATA")) then
|
||||||
file.CreateDir("gm_integration")
|
file.CreateDir("gm_integration")
|
||||||
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
||||||
else
|
else
|
||||||
if (gmInte.config.id && gmInte.config.id != "") then return end
|
if (gmInte.config.id && gmInte.config.id != "") then return end
|
||||||
|
|
||||||
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
|
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
|
||||||
if (oldConfig.version < gmInte.version) then
|
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
|
||||||
gmInte.config = table.Merge(gmInte.config, oldConfig)
|
gmInte.config = table.Merge(gmInte.config, oldConfig)
|
||||||
gmInte.config.version = gmInte.version
|
gmInte.config.version = gmInte.version
|
||||||
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
||||||
|
@ -84,4 +84,3 @@ print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
|
||||||
print(" ")
|
print(" ")
|
||||||
loadAllFiles("gmod_integration")
|
loadAllFiles("gmod_integration")
|
||||||
print(" ")
|
print(" ")
|
||||||
print(" ")
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user