From 3f788a3d3e567403200454eb1435f3a6d69bdde1 Mon Sep 17 00:00:00 2001 From: gocha Date: Wed, 15 Aug 2012 11:21:18 +0900 Subject: [PATCH] Lua: fix emu.message() not to overwrite the display string by other Lua functions. --- lua-engine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua-engine.cpp b/lua-engine.cpp index 2d18d1ad..456013fd 100644 --- a/lua-engine.cpp +++ b/lua-engine.cpp @@ -1062,7 +1062,12 @@ DEFINE_LUA_FUNCTION(print, "...") DEFINE_LUA_FUNCTION(emu_message, "str") { const char* str = toCString(L); - S9xSetInfoString(str); + + static char msg[1024]; + strncpy(msg, str, 1024); + msg[1024] = '\0'; + + S9xSetInfoString(msg); return 0; }