diff --git a/src/controllers/plugins/api/HTTPRequest.cpp b/src/controllers/plugins/api/HTTPRequest.cpp index 0985de8eb..9f1c828b8 100644 --- a/src/controllers/plugins/api/HTTPRequest.cpp +++ b/src/controllers/plugins/api/HTTPRequest.cpp @@ -31,8 +31,9 @@ namespace chatterino::lua::api { void HTTPRequest::createUserType(sol::table &c2) { - c2.new_usertype( // - "HTTPRequest", sol::no_constructor, // + c2.new_usertype( // + "HTTPRequest", sol::no_constructor, // + sol::meta_method::to_string, &HTTPRequest::to_string, // "on_success", &HTTPRequest::on_success, // "on_error", &HTTPRequest::on_error, // @@ -172,5 +173,10 @@ HTTPRequest::~HTTPRequest() // but that's better than accessing a possibly invalid lua_State pointer. } +QString HTTPRequest::to_string() +{ + return ""; +} + } // namespace chatterino::lua::api #endif diff --git a/src/controllers/plugins/api/HTTPRequest.hpp b/src/controllers/plugins/api/HTTPRequest.hpp index 43087aeaf..ba3052ac9 100644 --- a/src/controllers/plugins/api/HTTPRequest.hpp +++ b/src/controllers/plugins/api/HTTPRequest.hpp @@ -2,13 +2,16 @@ #ifdef CHATTERINO_HAVE_PLUGINS # include "common/network/NetworkRequest.hpp" # include "controllers/plugins/LuaUtilities.hpp" -# include "controllers/plugins/PluginController.hpp" # include # include # include +namespace chatterino { +class PluginController; +} // namespace chatterino + namespace chatterino::lua::api { // NOLINTBEGIN(readability-identifier-naming) @@ -110,6 +113,11 @@ public: * @exposed HTTPRequest:execute */ void execute(sol::this_state L); + /** + * @lua@return string + * @exposed HTTPRequest:__tostring + */ + QString to_string(); /** * Static functions