Try block in notify

This commit is contained in:
Federico Cecchetto 2022-04-30 00:26:57 +02:00
parent 8f6a927792
commit 31e1b9b7fb

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "execution.hpp"
#include "component/ui_scripting.hpp"
#include "component/game_console.hpp"
#include <utils/string.hpp>
@ -88,6 +89,8 @@ namespace ui_scripting
const auto _1 = gsl::finally(game::LUI_LeaveCriticalSection);
game::LUI_EnterCriticalSection();
try
{
const auto globals = table((*::game::hks::lua_state)->globals.v.table);
const auto engine = globals.get("Engine").as<table>();
const auto root = engine.get("GetLuiRoot")()[0].as<userdata>();
@ -105,6 +108,13 @@ namespace ui_scripting
process_event(root, event);
return true;
}
catch (const std::exception& e)
{
game_console::print(game_console::con_type_error, "Error processing event '%s' %s\n", name.data(), e.what());
}
return false;
}
arguments call_script_function(const function& function, const arguments& arguments)
{