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

[CSM] Add method that display chat to client-sided lua. (#5089) (#5091)

* squashed: [Client-sided scripting] Don't register functions that don't work. (#5091)
This commit is contained in:
red-001 2017-01-21 21:44:37 +00:00 committed by Loïc Blot
parent 2efae3ffd7
commit cb3a61f8db
10 changed files with 66 additions and 6 deletions

View file

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "l_client.h"
#include "l_internal.h"
#include "util/string.h"
int ModApiClient::l_get_current_modname(lua_State *L)
{
@ -27,7 +28,18 @@ int ModApiClient::l_get_current_modname(lua_State *L)
return 1;
}
// display_chat_message(message)
int ModApiClient::l_display_chat_message(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string message = luaL_checkstring(L, 1);
getClient(L)->pushToChatQueue(utf8_to_wide(message));
return 1;
}
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
API_FCT(display_chat_message);
}