diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-23 01:01:23 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-23 01:01:23 +1000 |
commit | 5fa97741e509f813d28db90e7bce1aac45e22829 (patch) | |
tree | 3095676703537068857c55dfc7b4311e33f03706 /source/game/scripting/StarLuaGameConverters.hpp | |
parent | cb19eef701b5c9e27d0464795fffcf8a4d795a21 (diff) |
experimental universe.sendWorldMessage function
Diffstat (limited to 'source/game/scripting/StarLuaGameConverters.hpp')
-rw-r--r-- | source/game/scripting/StarLuaGameConverters.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/game/scripting/StarLuaGameConverters.hpp b/source/game/scripting/StarLuaGameConverters.hpp index ff84792..6188bf1 100644 --- a/source/game/scripting/StarLuaGameConverters.hpp +++ b/source/game/scripting/StarLuaGameConverters.hpp @@ -10,6 +10,7 @@ #include "StarBehaviorState.hpp" #include "StarSystemWorld.hpp" #include "StarDrawable.hpp" +#include "StarRpcThreadPromise.hpp" namespace Star { @@ -33,6 +34,14 @@ struct LuaUserDataMethods<RpcPromise<T>> { static LuaMethods<RpcPromise<T>> make(); }; +template <typename T> +struct LuaConverter<RpcThreadPromise<T>> : LuaUserDataConverter<RpcThreadPromise<T>> {}; + +template <typename T> +struct LuaUserDataMethods<RpcThreadPromise<T>> { + static LuaMethods<RpcThreadPromise<T>> make(); +}; + template <> struct LuaConverter<PlatformerAStar::Path> { static LuaValue from(LuaEngine& engine, PlatformerAStar::Path const& path); @@ -115,6 +124,16 @@ LuaMethods<RpcPromise<T>> LuaUserDataMethods<RpcPromise<T>>::make() { return methods; } +template <typename T> +LuaMethods<RpcThreadPromise<T>> LuaUserDataMethods<RpcThreadPromise<T>>::make() { + LuaMethods<RpcThreadPromise<T>> methods; + methods.template registerMethodWithSignature<bool, RpcThreadPromise<T>&>("finished", mem_fn(&RpcThreadPromise<T>::finished)); + methods.template registerMethodWithSignature<bool, RpcThreadPromise<T>&>("succeeded", mem_fn(&RpcThreadPromise<T>::succeeded)); + methods.template registerMethodWithSignature<Maybe<T>, RpcThreadPromise<T>&>("result", mem_fn(&RpcThreadPromise<T>::result)); + methods.template registerMethodWithSignature<Maybe<String>, RpcThreadPromise<T>&>("error", mem_fn(&RpcThreadPromise<T>::error)); + return methods; +} + template <> struct LuaConverter<Collection> { static LuaValue from(LuaEngine& engine, Collection const& c); |