diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs index 70d10a33fd..7320d1d6c4 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs @@ -21,7 +21,10 @@ namespace BizHawk.Client.EmuHawk [LuaMethodAttributes("clear", "clears the output box of the Lua Console window")] public static void Clear() { - GlobalWin.Tools.LuaConsole.ClearOutputWindow(); + if (GlobalWin.Tools.Has()) + { + GlobalWin.Tools.LuaConsole.ClearOutputWindow(); + } } [LuaMethodAttributes("getluafunctionslist", "returns a list of implemented functions")] @@ -39,19 +42,28 @@ namespace BizHawk.Client.EmuHawk [LuaMethodAttributes("log", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] public static void Log(params object[] outputs) { - LogWithSeparator("\t", "\n", outputs); + if (GlobalWin.Tools.Has()) + { + LogWithSeparator("\t", "\n", outputs); + } } //// Single param version is used by logOutputCallback of some libraries. public static void LogOutput(object output) { - Log(output); + if (GlobalWin.Tools.Has()) + { + Log(output); + } } [LuaMethodAttributes("writeline", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] public static void WriteLine(params object[] outputs) { - LogWithSeparator("\n", "\n", outputs); + if (GlobalWin.Tools.Has()) + { + LogWithSeparator("\n", "\n", outputs); + } } [LuaMethodAttributes("write", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] @@ -63,6 +75,11 @@ namespace BizHawk.Client.EmuHawk // Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable private static void LogWithSeparator(string separator, string terminator, params object[] outputs) { + if (!GlobalWin.Tools.Has()) + { + return; + } + if (outputs == null) { GlobalWin.Tools.LuaConsole.WriteToOutputWindow("(no return)" + terminator);