From d0466c5588e1349325a4f8d7dd52ae6746a44631 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Tue, 6 Aug 2013 22:06:21 +0300 Subject: [PATCH] Script: Additional change to f8c3867 for `print()` --- Library/lua/LuaManager.h | 2 ++ Library/lua/glue/LuaGlobal.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/lua/LuaManager.h b/Library/lua/LuaManager.h index 241f7187..b2eb3f13 100644 --- a/Library/lua/LuaManager.h +++ b/Library/lua/LuaManager.h @@ -34,6 +34,8 @@ public: static lua_State* GetState(bool unicode) { c_UnicodeState = unicode; return c_State; } + static bool IsUnicodeState() { return c_UnicodeState; } + static void ReportErrors(const std::wstring& file); static void PushWide(const WCHAR* str); diff --git a/Library/lua/glue/LuaGlobal.cpp b/Library/lua/glue/LuaGlobal.cpp index 414e4e9e..d6a61f1c 100644 --- a/Library/lua/glue/LuaGlobal.cpp +++ b/Library/lua/glue/LuaGlobal.cpp @@ -54,7 +54,8 @@ static int Print(lua_State* L) lua_pop(L, 1); } - LogDebug(StringUtil::Widen(message).c_str()); + LogDebug(LuaManager::IsUnicodeState() ? + StringUtil::WidenUTF8(message).c_str() : StringUtil::Widen(message).c_str()); return 0; }