aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_client.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-07-15 09:28:10 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2017-07-15 09:28:10 +0200
commit84aa84591183db08489cad4e5a26472dbd7050b2 (patch)
treee436d6089b03dc6f715202a4faff9227ae5cb408 /src/script/lua_api/l_client.cpp
parentfafa51202c3bd6e46a44eacbc7f42ef697835945 (diff)
downloadminetest-84aa84591183db08489cad4e5a26472dbd7050b2.tar.gz
minetest-84aa84591183db08489cad4e5a26472dbd7050b2.tar.bz2
minetest-84aa84591183db08489cad4e5a26472dbd7050b2.zip
Revert "CSM: Revert "[CSM] Add send_chat_message and run_server_chatcommand""
This reverts commit bdac12761cd92960c3df83c932aa610f2322215f.
Diffstat (limited to 'src/script/lua_api/l_client.cpp')
-rw-r--r--src/script/lua_api/l_client.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 0b957a6e2..1077d5f2d 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -85,6 +85,23 @@ int ModApiClient::l_display_chat_message(lua_State *L)
return 1;
}
+// send_chat_message(message)
+int ModApiClient::l_send_chat_message(lua_State *L)
+{
+ if (!lua_isstring(L, 1))
+ return 0;
+ std::string message = luaL_checkstring(L, 1);
+ getClient(L)->sendChatMessage(utf8_to_wide(message));
+ return 0;
+}
+
+// clear_out_chat_queue()
+int ModApiClient::l_clear_out_chat_queue(lua_State *L)
+{
+ getClient(L)->clearOutChatQueue();
+ return 0;
+}
+
// get_player_names()
int ModApiClient::l_get_player_names(lua_State *L)
{
@@ -337,6 +354,8 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(get_current_modname);
API_FCT(print);
API_FCT(display_chat_message);
+ API_FCT(send_chat_message);
+ API_FCT(clear_out_chat_queue);
API_FCT(get_player_names);
API_FCT(set_last_run_mod);
API_FCT(get_last_run_mod);