Add luinotify function

This commit is contained in:
Federico Cecchetto 2022-08-17 03:07:14 +02:00
parent 03e5a9b00f
commit cc1297170a

View File

@ -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 <utils/string.hpp>
#include <utils/io.hpp>
@ -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<function_ptr>("functionptr",
sol::constructors<function_ptr(const std::string&, const std::string&)>());