Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- src/scripting/lua_gui2.cpp | 30 +++++++++++++++++-------------
- 1 file changed, 17 insertions(+), 13 deletions(-)
- diff --git a/src/scripting/lua_gui2.cpp b/src/scripting/lua_gui2.cpp
- index 92e510061f..14e3a7bd40 100644
- --- a/src/scripting/lua_gui2.cpp
- +++ b/src/scripting/lua_gui2.cpp
- @@ -47,6 +47,7 @@
- #endif
- #include "config.hpp"
- +#include "events.hpp"
- #include "log.hpp"
- #include "scripting/lua_common.hpp"
- #include "scripting/lua_kernel_base.hpp"
- @@ -242,24 +243,27 @@ namespace lua_gui2 {
- */
- int show_dialog(lua_State* L)
- {
- - config def_cfg = luaW_checkconfig(L, 1);
- + events::call_in_main_thread([L]() {
- + config def_cfg = luaW_checkconfig(L, 1);
- - gui2::builder_window::window_resolution def(def_cfg);
- - scoped_dialog w(L, gui2::build(&def));
- + gui2::builder_window::window_resolution def(def_cfg);
- + scoped_dialog w(L, gui2::build(&def));
- - if(!lua_isnoneornil(L, 2)) {
- - lua_pushvalue(L, 2);
- - lua_call(L, 0, 0);
- - }
- + if(!lua_isnoneornil(L, 2)) {
- + lua_pushvalue(L, 2);
- + lua_call(L, 0, 0);
- + }
- - int v = scoped_dialog::current->window->show(true, 0);
- + int v = scoped_dialog::current->window->show(true, 0);
- - if (!lua_isnoneornil(L, 3)) {
- - lua_pushvalue(L, 3);
- - lua_call(L, 0, 0);
- - }
- + if (!lua_isnoneornil(L, 3)) {
- + lua_pushvalue(L, 3);
- + lua_call(L, 0, 0);
- + }
- +
- + lua_pushinteger(L, v);
- + });
- - lua_pushinteger(L, v);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement