Skip to content

Commit

Permalink
use a beammp_lua_errorf instead of a std::terminate on sol2 assertion…
Browse files Browse the repository at this point in the history
… failure
  • Loading branch information
lionkor committed Dec 5, 2023
1 parent 872c2d4 commit 03307e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/TLuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include <vector>

#define SOL_ALL_SAFETIES_ON 1
#define SOL_USER_C_ASSERT SOL_ON
#define SOL_C_ASSERT(...) \
beammp_lua_errorf("SOL2 assertion failure: Assertion `{}` failed in {}:{}. This *should* be a fatal error, but BeamMP Server overrides it to not be fatal. This may cause the Lua Engine to crash, or cause other issues.", #__VA_ARGS__, __FILE__, __LINE__)
#include <sol/sol.hpp>

using TLuaStateId = std::string;
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int BeamMPServerMain(MainArguments Arguments) {
Application::Console().WriteRaw("BeamMP-Server v" + Application::ServerVersionString());
return 0;
}

std::string ConfigPath = "ServerConfig.toml";
if (Parser.FoundArgument({ "config" })) {
auto MaybeConfigPath = Parser.GetValueOfArgument({ "config" });
Expand Down

0 comments on commit 03307e7

Please sign in to comment.