Skip to content

Commit

Permalink
keep the old lua print function (to cout) around, as "std_print"
Browse files Browse the repository at this point in the history
name should change maybe
  • Loading branch information
cbeck88 committed Nov 20, 2014
1 parent c282bdf commit e7e0bb5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/scripting/lua_kernel_base.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit e7e0bb5

Please sign in to comment.