aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-28 20:02:23 +0200
committerGitHub <noreply@github.com>2017-08-28 20:02:23 +0200
commit5f38fe33f89e87b56ab95370c2f07fe6117b5eb0 (patch)
treee2a497bb99f37ce6baae56d2979a2ae957829dc2 /src/script/lua_api
parent6fd8a27c91b09f51693243586af3615f962d1730 (diff)
downloadminetest-5f38fe33f89e87b56ab95370c2f07fe6117b5eb0.tar.gz
minetest-5f38fe33f89e87b56ab95370c2f07fe6117b5eb0.tar.bz2
minetest-5f38fe33f89e87b56ab95370c2f07fe6117b5eb0.zip
Clientevent refactor (#6320)
* Refactor clientevent structure * Move structure outside of client header * Create client events on heap not stack, this remove the ClientEvent object copy * Use clientEventHandler to route events
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_client.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 81bf49329..ba22a0424 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "l_client.h"
#include "chatmessage.h"
#include "client.h"
+#include "client/clientevent.h"
#include "clientenvironment.h"
#include "common/c_content.h"
#include "common/c_converter.h"
@@ -129,10 +130,10 @@ int ModApiClient::l_show_formspec(lua_State *L)
if (!lua_isstring(L, 1) || !lua_isstring(L, 2))
return 0;
- ClientEvent event;
- event.type = CE_SHOW_LOCAL_FORMSPEC;
- event.show_formspec.formname = new std::string(luaL_checkstring(L, 1));
- event.show_formspec.formspec = new std::string(luaL_checkstring(L, 2));
+ ClientEvent *event = new ClientEvent();
+ event->type = CE_SHOW_LOCAL_FORMSPEC;
+ event->show_formspec.formname = new std::string(luaL_checkstring(L, 1));
+ event->show_formspec.formspec = new std::string(luaL_checkstring(L, 2));
getClient(L)->pushToEventQueue(event);
lua_pushboolean(L, true);
return 1;