mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 06:37:34 +00:00
opti
This commit is contained in:
parent
7a3f3d3c9e
commit
01dd65cd85
|
@ -2,11 +2,6 @@
|
||||||
// Functions
|
// Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
function gmInte.isCodeValid(code)
|
|
||||||
// if first number is 2
|
|
||||||
return string.sub(code, 1, 1) == "2"
|
|
||||||
end
|
|
||||||
|
|
||||||
function gmInte.httpError(error)
|
function gmInte.httpError(error)
|
||||||
gmInte.log("Web request failed")
|
gmInte.log("Web request failed")
|
||||||
gmInte.log("Error details: "..error)
|
gmInte.log("Error details: "..error)
|
||||||
|
@ -34,10 +29,8 @@ local function sendHTTP(params)
|
||||||
success = function(code, body, headers)
|
success = function(code, body, headers)
|
||||||
gmInte.log("HTTP Response: " .. code, true)
|
gmInte.log("HTTP Response: " .. code, true)
|
||||||
gmInte.log("HTTP Body: " .. body, true)
|
gmInte.log("HTTP Body: " .. body, true)
|
||||||
if (gmInte.isCodeValid(code)) then
|
if (string.sub(code, 1, 1) == "2") then
|
||||||
if (params.success) then
|
params.success && params.success(body, code, headers)
|
||||||
params.success(code, body, headers)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
gmInte.httpError(body)
|
gmInte.httpError(body)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user