From e8d43a8fc31fc75adeccebb7ea5386da800a0371 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 11 Sep 2025 17:36:33 +0300 Subject: [PATCH] fix network.__post does not return request id --- src/logic/scripting/lua/libs/libnetwork.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/logic/scripting/lua/libs/libnetwork.cpp b/src/logic/scripting/lua/libs/libnetwork.cpp index 378f0cbc..c41a32d8 100644 --- a/src/logic/scripting/lua/libs/libnetwork.cpp +++ b/src/logic/scripting/lua/libs/libnetwork.cpp @@ -86,7 +86,7 @@ static int perform_get(lua::State* L, network::Network& network, bool binary) { std::string url(lua::require_lstring(L, 1)); auto headers = read_headers(L, 2); - int currentRequestId = request_id; + int currentRequestId = request_id++; network.get(url, [currentRequestId, binary](std::vector bytes) { push_event(NetworkEvent( @@ -109,7 +109,7 @@ static int perform_get(lua::State* L, network::Network& network, bool binary) { } )); }, std::move(headers)); - return lua::pushinteger(L, request_id++); + return lua::pushinteger(L, currentRequestId); } static int l_get(lua::State* L, network::Network& network) { @@ -132,7 +132,7 @@ static int l_post(lua::State* L, network::Network& network) { } auto headers = read_headers(L, 3); - int currentRequestId = request_id; + int currentRequestId = request_id++; engine->getNetwork().post( url, @@ -157,7 +157,7 @@ static int l_post(lua::State* L, network::Network& network) { }, std::move(headers) ); - return 0; + return lua::pushinteger(L, currentRequestId); } static int l_close(lua::State* L, network::Network& network) {