diff options
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); |