fix fatal error on uncaught lua exceptions in network functions calls

This commit is contained in:
MihailRis
2024-11-29 20:32:18 +03:00
parent b69494aea3
commit 05003a4082
3 changed files with 22 additions and 4 deletions
+17
View File
@@ -263,6 +263,23 @@ scripting::common_func lua::create_lambda(State* L) {
};
}
scripting::common_func lua::create_lambda_nothrow(State* L) {
auto funcptr = create_lambda_handler(L);
return [=](const std::vector<dv::value>& args) -> dv::value {
getglobal(L, LAMBDAS_TABLE);
getfield(L, *funcptr);
for (const auto& arg : args) {
pushvalue(L, arg);
}
if (call_nothrow(L, args.size(), 1)) {
auto result = tovalue(L, -1);
pop(L);
return result;
}
return nullptr;
};
}
int lua::create_environment(State* L, int parent) {
int id = nextEnvironment++;