From 03851153ed1606237900e977c55241cfdb2f1e96 Mon Sep 17 00:00:00 2001 From: Brendan Byrd Date: Sat, 24 Nov 2018 12:25:29 -0500 Subject: [PATCH] Don't Lua print extra newlines in *NIX --- src/lua-engine.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 2bb89116..c40805a4 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -1694,15 +1694,20 @@ static const char* toCString(lua_State* L, int idx) // replacement for luaB_print() that goes to the appropriate textbox instead of stdout static int print(lua_State *L) { - const char* str = toCString(L); + if (info_print) { + const char* str = toCString(L); - int uid = info_uid;//luaStateToUIDMap[L->l_G->mainthread]; - //LuaContextInfo& info = GetCurrentInfo(); + int uid = info_uid;//luaStateToUIDMap[L->l_G->mainthread]; + //LuaContextInfo& info = GetCurrentInfo(); - if(info_print) info_print(uid, str); - else + } + else { + char* str = rawToCString(L); + str[strlen(str)-2] = 0; // *NIX need no extra \r\n BS + puts(str); + } //worry(L, 100); return 0;