1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add option to not prepend "Server -!- " to messages sent with minetest.chat_send_player()

This commit is contained in:
ShadowNinja 2013-03-29 23:28:13 -04:00 committed by Perttu Ahola
parent 9894167bbf
commit 3d4d0cb574
5 changed files with 14 additions and 7 deletions

View file

@ -754,15 +754,18 @@ static int l_chat_send_all(lua_State *L)
return 0;
}
// chat_send_player(name, text)
// chat_send_player(name, text, prepend)
static int l_chat_send_player(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
const char *text = luaL_checkstring(L, 2);
bool prepend = true;
if (lua_isboolean(L, 3))
prepend = lua_toboolean(L, 3);
// Get server from registry
Server *server = get_server(L);
// Send
server->notifyPlayer(name, narrow_to_wide(text));
server->notifyPlayer(name, narrow_to_wide(text), prepend);
return 0;
}