Skip to content

Commit

Permalink
[CSM] Correct the log destination of print() (#5784)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker authored and nerzhul committed May 20, 2017
1 parent 772944d commit af2f025
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/script/lua_api/l_client.cpp
Expand Up @@ -63,6 +63,15 @@ int ModApiClient::l_set_last_run_mod(lua_State *L)
return 1;
}

// print(text)
int ModApiClient::l_print(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string text = luaL_checkstring(L, 1);
rawstream << text << std::endl;
return 0;
}

// display_chat_message(message)
int ModApiClient::l_display_chat_message(lua_State *L)
{
Expand Down Expand Up @@ -261,6 +270,7 @@ int ModApiClient::l_take_screenshot(lua_State *L)
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
API_FCT(print);
API_FCT(display_chat_message);
API_FCT(get_player_names);
API_FCT(set_last_run_mod);
Expand Down
3 changes: 3 additions & 0 deletions src/script/lua_api/l_client.h
Expand Up @@ -29,6 +29,9 @@ class ModApiClient : public ModApiBase
// get_current_modname()
static int l_get_current_modname(lua_State *L);

// print(text)
static int l_print(lua_State *L);

// display_chat_message(message)
static int l_display_chat_message(lua_State *L);

Expand Down

0 comments on commit af2f025

Please sign in to comment.