luaL_error use replaced with c++ exceptions

This commit is contained in:
MihailRis
2024-05-12 11:00:11 +03:00
parent 9522aedeec
commit 548c55fced
9 changed files with 80 additions and 73 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
#include "../../../window/input.hpp"
#include "../../../window/Events.hpp"
#include "../../../util/stringutil.hpp"
#include "../../../frontend/screens/Screen.hpp"
#include "../../../frontend/hud.hpp"
#include "../../../engine.hpp"
@@ -26,7 +27,7 @@ static int l_add_callback(lua_State* L) {
auto bindname = lua_tostring(L, 1);
const auto& bind = Events::bindings.find(bindname);
if (bind == Events::bindings.end()) {
luaL_error(L, "unknown binding %q", bindname);
throw std::runtime_error("unknown binding "+util::quote(bindname));
}
state->pushvalue(2);
runnable callback = state->createRunnable();