mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 21:17:34 +00:00
fix typo
This commit is contained in:
parent
328f446c6d
commit
3230849679
|
@ -14,7 +14,7 @@ function gmInte.SendNet(id, args, func)
|
|||
net.Start("gmIntegration")
|
||||
net.WriteUInt(id, 8)
|
||||
net.WriteString(util.TableToJSON(args || {}))
|
||||
func && func()
|
||||
if (func) then func() end
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
|
@ -28,5 +28,5 @@ local netFunc = {
|
|||
net.Receive("gmIntegration", function()
|
||||
local id = net.ReadUInt(8)
|
||||
local args = util.JSONToTable(net.ReadString())
|
||||
netFunc[id] && netFunc[id](args)
|
||||
if (netFunc[id]) then netFunc[id](args) end
|
||||
end)
|
|
@ -16,7 +16,7 @@ function gmInte.SendNet(id, data, ply, func)
|
|||
net.Start("gmIntegration")
|
||||
net.WriteUInt(id, 8)
|
||||
net.WriteString(util.TableToJSON(data))
|
||||
func && func()
|
||||
if (func) then func() end
|
||||
net.Send(ply)
|
||||
end
|
||||
|
||||
|
@ -31,5 +31,5 @@ net.Receive("gmIntegration", function(len, ply)
|
|||
if !ply:IsPlayer() then return end
|
||||
local id = net.ReadUInt(8)
|
||||
local data = util.JSONToTable(net.ReadString() || "{}")
|
||||
netFuncs[id] && netFuncs[id](ply, data)
|
||||
if (netFuncs[id]) then netFuncs[id](ply, data) end
|
||||
end)
|
|
@ -1,3 +1,9 @@
|
|||
//
|
||||
// WebSocket
|
||||
//
|
||||
|
||||
if (!GWSockets) then return gmInte.logError("GWSockets not found!") end
|
||||
|
||||
require("gwsockets")
|
||||
|
||||
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
|
||||
|
|
|
@ -21,7 +21,9 @@ local function sendHTTP(params)
|
|||
gmInte.log("HTTP Response: " .. code, true)
|
||||
gmInte.log("HTTP Body: " .. body, true)
|
||||
if (string.sub(code, 1, 1) == "2") then
|
||||
params.success && params.success(body, code, headers)
|
||||
if (params.success) then
|
||||
params.success(body, code, headers)
|
||||
end
|
||||
else
|
||||
gmInte.logError("HTTP Request failed with code " .. code .. " and body " .. body)
|
||||
end
|
||||
|
|
|
@ -12,5 +12,5 @@ end
|
|||
function gmInte.logError(msg, debug)
|
||||
if (debug && !gmInte.config.debug) then return end
|
||||
print("[" .. os.date("%Y-%m-%d %H:%M:%S") .. "] [Gmod Integration] [ERROR] " .. msg)
|
||||
debug && print(debug.traceback())
|
||||
if (debug) then print(debug.traceback()) end
|
||||
end
|
Loading…
Reference in New Issue
Block a user