aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2017-05-20 16:46:12 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-05-20 16:46:12 +0200
commitaf2f02552f1999b9b491fc44386be5c1ea8a8882 (patch)
treec5e1a684bf5f7fb486d0bdfd5ffa68b2a90f967b /src
parent772944daf69ab463568fbbf35a9011e4c8e6c44a (diff)
downloadminetest-af2f02552f1999b9b491fc44386be5c1ea8a8882.tar.gz
minetest-af2f02552f1999b9b491fc44386be5c1ea8a8882.tar.bz2
minetest-af2f02552f1999b9b491fc44386be5c1ea8a8882.zip
[CSM] Correct the log destination of print() (#5784)
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_client.cpp10
-rw-r--r--src/script/lua_api/l_client.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 7f89a4d5d..22045e06d 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -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)
{
@@ -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);
diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h
index a36d7e51c..2267a4c9d 100644
--- a/src/script/lua_api/l_client.h
+++ b/src/script/lua_api/l_client.h
@@ -29,6 +29,9 @@ private:
// 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);