mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 21:17:34 +00:00
better file load
This commit is contained in:
parent
61d59d886c
commit
878008e719
|
@ -4,9 +4,9 @@ if game.SinglePlayer() then return end
|
|||
// Variables
|
||||
//
|
||||
|
||||
gmInte = gmInte || {}
|
||||
gmInte.version = "0.1.2"
|
||||
gmInte.config = gmInte.config || {}
|
||||
gmInte = {}
|
||||
gmInte.version = "0.1.3"
|
||||
gmInte.config = {}
|
||||
|
||||
//
|
||||
// Functions
|
||||
|
@ -24,10 +24,11 @@ local function loadConfig()
|
|||
|
||||
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
|
||||
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
|
||||
if (oldConfig.version < "0.1.2") then
|
||||
if (oldConfig.version && (oldConfig.version < "0.1.2")) then
|
||||
gmInte.config.id = oldConfig.id
|
||||
gmInte.config.token = oldConfig.token
|
||||
else
|
||||
print(" | Merging Config | gmod_integration/sv_config.lua")
|
||||
table.Merge(gmInte.config, oldConfig)
|
||||
end
|
||||
gmInte.config.version = gmInte.version
|
||||
|
|
|
@ -31,4 +31,14 @@ function socket:onError(txt)
|
|||
gmInte.logError("WebSocket Error: " .. txt)
|
||||
end
|
||||
|
||||
socket:open()
|
||||
function gmInte.websocketSend(data)
|
||||
socket:send(util.TableToJSON(data))
|
||||
end
|
||||
|
||||
hook.Add("InitPostEntity", "gmInte:ServerReady:WebSocket", function()
|
||||
if (gmInte.config.websocket) then wsConnect() end
|
||||
end)
|
||||
|
||||
if (gmInte.config.debug) then wsConnect() end
|
||||
|
||||
print(gmInte.config.debug && "WebSocket Debug Mode" || "WebSocket")
|
Loading…
Reference in New Issue
Block a user