]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_client.cpp
Clientevent refactor (#6320)
[dragonfireclient.git] / src / script / lua_api / l_client.cpp
index 81bf49329fe61f21bb4428df1b59e3e7ab32c6e6..ba22a04242c646c7f72ea7f7ac4885f8ca4065f7 100644 (file)
@@ -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;