mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Give HTTPRequest a __tostring
This commit is contained in:
parent
90bcdc8bf5
commit
7b5ed5297e
|
@ -31,8 +31,9 @@ namespace chatterino::lua::api {
|
|||
|
||||
void HTTPRequest::createUserType(sol::table &c2)
|
||||
{
|
||||
c2.new_usertype<HTTPRequest>( //
|
||||
"HTTPRequest", sol::no_constructor, //
|
||||
c2.new_usertype<HTTPRequest>( //
|
||||
"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 "<HTTPRequest>";
|
||||
}
|
||||
|
||||
} // namespace chatterino::lua::api
|
||||
#endif
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||
# include "common/network/NetworkRequest.hpp"
|
||||
# include "controllers/plugins/LuaUtilities.hpp"
|
||||
# include "controllers/plugins/PluginController.hpp"
|
||||
|
||||
# include <sol/forward.hpp>
|
||||
# include <sol/types.hpp>
|
||||
|
||||
# include <memory>
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue