mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Make c2_later throw not longjmp
This commit is contained in:
parent
340f50c4ab
commit
53ae8ab8ca
|
@ -23,6 +23,7 @@
|
|||
# include <sol/variadic_args.hpp>
|
||||
# include <sol/variadic_results.hpp>
|
||||
|
||||
# include <stdexcept>
|
||||
# include <string>
|
||||
# include <utility>
|
||||
|
||||
|
@ -104,12 +105,12 @@ void c2_log(sol::this_state L, Plugin *pl, LogLevel lvl,
|
|||
}
|
||||
}
|
||||
|
||||
int c2_later(sol::this_state L, sol::protected_function callback, int time)
|
||||
void c2_later(sol::this_state L, sol::protected_function callback, int time)
|
||||
{
|
||||
auto *pl = getApp()->getPlugins()->getPluginByStatePtr(L);
|
||||
if (pl == nullptr)
|
||||
{
|
||||
return luaL_error(L, "c2.later: internal error: no plugin?");
|
||||
throw std::runtime_error("c2.later: internal error: no plugin?");
|
||||
}
|
||||
sol::state_view lua(L);
|
||||
|
||||
|
@ -137,8 +138,6 @@ int c2_later(sol::this_state L, sol::protected_function callback, int time)
|
|||
main.registry()[name.toStdString()] = sol::nil;
|
||||
});
|
||||
timer->start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sol::variadic_results g_load(sol::this_state s, sol::object data)
|
||||
|
|
|
@ -123,7 +123,7 @@ void c2_log(sol::this_state L, Plugin *pl, LogLevel lvl,
|
|||
* @lua@param msec number How long to wait.
|
||||
* @exposed c2.later
|
||||
*/
|
||||
int c2_later(sol::this_state L, sol::protected_function callback, int time);
|
||||
void c2_later(sol::this_state L, sol::protected_function callback, int time);
|
||||
|
||||
// These ones are global
|
||||
sol::variadic_results g_load(sol::this_state s, sol::object data);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# include "common/network/NetworkResult.hpp"
|
||||
|
||||
# include <lua.h>
|
||||
# include <sol/sol.hpp>
|
||||
|
||||
# include <memory>
|
||||
|
||||
|
|
|
@ -8,14 +8,7 @@
|
|||
# include <lauxlib.h>
|
||||
# include <lua.h>
|
||||
# include <QString>
|
||||
# include <sol/forward.hpp>
|
||||
# include <sol/in_place.hpp>
|
||||
# include <sol/object.hpp>
|
||||
# include <sol/protected_function_result.hpp>
|
||||
# include <sol/state_view.hpp>
|
||||
# include <sol/types.hpp>
|
||||
# include <sol/variadic_args.hpp>
|
||||
# include <sol/variadic_results.hpp>
|
||||
# include <sol/sol.hpp>
|
||||
|
||||
# include <cerrno>
|
||||
# include <stdexcept>
|
||||
|
|
Loading…
Reference in a new issue