diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs index 89c63f54a..ca8ed6841 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs @@ -140,21 +140,37 @@ namespace Barotrauma else if (exceptionType == ExceptionType.CSharp) PrintCsError(extra); else PrintBothError(extra); - if (ex is InterpreterException) + if (ex is NetRuntimeException netRuntimeException) { - if (((InterpreterException)ex).DecoratedMessage == null) - PrintError(((InterpreterException)ex).Message); + if (netRuntimeException.DecoratedMessage == null) + { + PrintError(netRuntimeException); + } else - PrintError(((InterpreterException)ex).DecoratedMessage); + { + PrintError(netRuntimeException.DecoratedMessage + ": " + netRuntimeException.ToString()); + } + } + else if (ex is InterpreterException interpreterException) + { + if (interpreterException.DecoratedMessage == null) + { + PrintError(interpreterException); + } + else + { + PrintError(interpreterException.DecoratedMessage); + } } else { string msg = ex.StackTrace != null ? ex.ToString() : $"{ex}\n{Environment.StackTrace}"; - if (exceptionType == ExceptionType.Lua) PrintError(msg); - else if (exceptionType == ExceptionType.CSharp) PrintCsError(msg); - else PrintBothError(msg); + + if (exceptionType == ExceptionType.Lua) { PrintError(msg); } + else if (exceptionType == ExceptionType.CSharp) { PrintCsError(msg); } + else { PrintBothError(msg); } } } @@ -422,6 +438,8 @@ namespace Barotrauma UserData.RegisterType(); UserData.RegisterType(); + LuaDocs.GenerateDocsAll(); + lua.Globals["printerror"] = (Action)PrintError; lua.Globals["setmodulepaths"] = (Action)SetModulePaths; diff --git a/Libraries/MoonSharp.Interpreter.dll b/Libraries/MoonSharp.Interpreter.dll index 8262e293e..243adee50 100644 Binary files a/Libraries/MoonSharp.Interpreter.dll and b/Libraries/MoonSharp.Interpreter.dll differ