From cc1297170ab553352bd44a553ba48ca2435936c0 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Wed, 17 Aug 2022 03:07:14 +0200 Subject: [PATCH] Add luinotify function --- src/client/game/scripting/lua/context.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/client/game/scripting/lua/context.cpp b/src/client/game/scripting/lua/context.cpp index 1d736821..e673e0fd 100644 --- a/src/client/game/scripting/lua/context.cpp +++ b/src/client/game/scripting/lua/context.cpp @@ -12,6 +12,9 @@ #include "../../../component/fastfiles.hpp" #include "../../../component/mods.hpp" #include "../../../component/localized_strings.hpp" +#include "../../../component/scheduler.hpp" + +#include "game/ui_scripting/execution.hpp" #include #include @@ -777,6 +780,14 @@ namespace scripting::lua scripting::get_dvar_int_overrides.erase(dvar); }; + game_type["luinotify"] = [](const game&, const std::string& name, const std::string& data) + { + ::scheduler::once([=]() + { + ui_scripting::notify(name, {{"data", data}}); + }, ::scheduler::pipeline::lui); + }; + auto function_ptr_type = state.new_usertype("functionptr", sol::constructors());