Fix HTTP API not being available in async mainmenu (#10086)
authorrubenwardy <rw@rubenwardy.com>
Mon, 22 Jun 2020 13:40:04 +0000 (14:40 +0100)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2020 13:40:04 +0000 (14:40 +0100)
src/script/lua_api/l_http.cpp
src/script/lua_api/l_http.h
src/script/scripting_mainmenu.cpp

index 73b4586e0af7a5bf0aa97964a557467713788d60..ec43bf174d2ba87ee9a5ca77d093219d41a313b1 100644 (file)
@@ -230,3 +230,10 @@ void ModApiHttp::Initialize(lua_State *L, int top)
 
 #endif
 }
+
+void ModApiHttp::InitializeAsync(lua_State *L, int top)
+{
+#if USE_CURL
+       API_FCT(get_http_api);
+#endif
+}
index c665235a99183594a94d83e72de2735d988e3007..de6e51b3746194b6b7710bf2d5de1421e4e7e8d5 100644 (file)
@@ -50,4 +50,5 @@ private:
 
 public:
        static void Initialize(lua_State *L, int top);
+       static void InitializeAsync(lua_State *L, int top);
 };
index 08858b1a5a5a9419bc19e46ac4cc9ebeea186ca3..0f672f9175c935eb0f7176e078d5424e3d5d56fb 100644 (file)
@@ -73,6 +73,7 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top)
        asyncEngine.registerStateInitializer(registerLuaClasses);
        asyncEngine.registerStateInitializer(ModApiMainMenu::InitializeAsync);
        asyncEngine.registerStateInitializer(ModApiUtil::InitializeAsync);
+       asyncEngine.registerStateInitializer(ModApiHttp::InitializeAsync);
 
        // Initialize async environment
        //TODO possibly make number of async threads configurable