From a1a3cc61cbfc1486132c7b652cd408894edb7ef7 Mon Sep 17 00:00:00 2001 From: Daniel-I-Am Date: Sun, 27 Sep 2020 12:27:17 +0200 Subject: [PATCH] Fix print not working --- .../LuaProgrammingLanguageInterpreter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs b/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs index bfdcb0a..2322e9b 100644 --- a/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs +++ b/ChaosBot/Services/ProgrammingLanguageInterpreter/LuaProgrammingLanguageInterpreter.cs @@ -26,7 +26,7 @@ namespace ChaosBot.Services.ProgrammingLanguageInterpreter MethodInfo printMethod = GetType().GetMethod("Print", BindingFlags.NonPublic | BindingFlags.Instance); LoggingFacade.Info($"Overwriting print function with {printMethod}"); - _state["print"] = printMethod; + _state["print"] = _state.RegisterFunction("print", this, printMethod); LoggingFacade.Trace("Disabling Lua `import` function"); _state.DoString ("\nimport = function () end\n"); @@ -51,9 +51,9 @@ namespace ChaosBot.Services.ProgrammingLanguageInterpreter // ReSharper disable once UnusedMember.Local private void Print(params object[] parameters) { - string str = string.Join(" ", from param in parameters select param == null ? string.Empty : param.ToString()); + string str = string.Join("\t", from param in parameters select param == null ? string.Empty : param.ToString()); - _outputBuilder.Append(str); + _outputBuilder.AppendLine(str); } } }