From e7e0bb57dc8cb1bdb46a9a0c2f5e2a580ee14507 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Thu, 20 Nov 2014 15:07:35 -0500 Subject: [PATCH] keep the old lua print function (to cout) around, as "std_print" name should change maybe --- src/scripting/lua_kernel_base.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripting/lua_kernel_base.cpp b/src/scripting/lua_kernel_base.cpp index e47f70ab19d8..2400d28cbced 100644 --- a/src/scripting/lua_kernel_base.cpp +++ b/src/scripting/lua_kernel_base.cpp @@ -655,6 +655,10 @@ lua_kernel_base::lua_kernel_base(CVideo * video) // Override the print function cmd_log_ << "Redirecting print function...\n"; + lua_getglobal(L, "print"); + lua_setglobal(L, "std_print"); //storing original impl as 'std_print' + lua_settop(L, 0); //clear stack, just to be sure + lua_cfunc my_print = boost::bind(&lua_kernel_base::intf_print, this, _1); push_boost_cfunc(L, my_print); lua_setglobal(L, "print");