Advertisement
Vultraz

Untitled

May 26th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.42 KB | None | 0 0
  1.  src/scripting/lua_gui2.cpp | 30 +++++++++++++++++-------------
  2.  1 file changed, 17 insertions(+), 13 deletions(-)
  3.  
  4. diff --git a/src/scripting/lua_gui2.cpp b/src/scripting/lua_gui2.cpp
  5. index 92e510061f..14e3a7bd40 100644
  6. --- a/src/scripting/lua_gui2.cpp
  7. +++ b/src/scripting/lua_gui2.cpp
  8. @@ -47,6 +47,7 @@
  9.  #endif
  10.  
  11.  #include "config.hpp"
  12. +#include "events.hpp"
  13.  #include "log.hpp"
  14.  #include "scripting/lua_common.hpp"
  15.  #include "scripting/lua_kernel_base.hpp"
  16. @@ -242,24 +243,27 @@ namespace lua_gui2 {
  17.   */
  18.  int show_dialog(lua_State* L)
  19.  {
  20. -   config def_cfg = luaW_checkconfig(L, 1);
  21. +   events::call_in_main_thread([L]() {
  22. +       config def_cfg = luaW_checkconfig(L, 1);
  23.  
  24. -   gui2::builder_window::window_resolution def(def_cfg);
  25. -   scoped_dialog w(L, gui2::build(&def));
  26. +       gui2::builder_window::window_resolution def(def_cfg);
  27. +       scoped_dialog w(L, gui2::build(&def));
  28.  
  29. -   if(!lua_isnoneornil(L, 2)) {
  30. -       lua_pushvalue(L, 2);
  31. -       lua_call(L, 0, 0);
  32. -   }
  33. +       if(!lua_isnoneornil(L, 2)) {
  34. +           lua_pushvalue(L, 2);
  35. +           lua_call(L, 0, 0);
  36. +       }
  37.  
  38. -   int v = scoped_dialog::current->window->show(true, 0);
  39. +       int v = scoped_dialog::current->window->show(true, 0);
  40.  
  41. -   if (!lua_isnoneornil(L, 3)) {
  42. -       lua_pushvalue(L, 3);
  43. -       lua_call(L, 0, 0);
  44. -   }
  45. +       if (!lua_isnoneornil(L, 3)) {
  46. +           lua_pushvalue(L, 3);
  47. +           lua_call(L, 0, 0);
  48. +       }
  49. +
  50. +       lua_pushinteger(L, v);
  51. +   });
  52.  
  53. -   lua_pushinteger(L, v);
  54.     return 1;
  55.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement