diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs index 6abc57e26..49a1cd15b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaClasses/LuaGame.cs @@ -119,9 +119,9 @@ namespace Barotrauma get { #if SERVER - return GameMain.Server.GameStarted; + return GameMain.Server?.GameStarted == true; #else - return GameMain.Client.GameStarted; + return GameMain.Client?.GameStarted == true; #endif } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs index 0e4e2aea6..b21ef9909 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs @@ -216,7 +216,7 @@ namespace Barotrauma if (methodInfo == null) { - string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames == null); + string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames); GameMain.LuaCs.HandleException(new Exception($"Method '{methodName}' with parameters '{parameterNamesStr}' not found in class '{className}'")); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs index 3e71baf4c..de1ce6c04 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsUtility.cs @@ -89,7 +89,7 @@ namespace Barotrauma } else { - GameMain.LuaCs.HandleException(new Exception("File access to \"" + path + "\" not allowed.")); + throw new Exception("File access to \"" + path + "\" not allowed."); } } else @@ -100,12 +100,11 @@ namespace Barotrauma } else { - GameMain.LuaCs.HandleException(new Exception("File access to \"" + path + "\" not allowed.")); + throw new Exception("File access to \"" + path + "\" not allowed."); } } - - return false; } + public static bool IsPathAllowedLuaException(string path, bool write = true) => IsPathAllowedException(path, write, LuaCsSetup.ExceptionType.Lua); public static bool IsPathAllowedCsException(string path, bool write = true) =>