diff options
author | Mattes D <github@xoft.cz> | 2020-04-14 16:43:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 16:43:21 +0200 |
commit | c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e (patch) | |
tree | 7d7ba1d772d1f4994773f325046a4e6229c91d16 /src/Bindings/LuaState.h | |
parent | Pressure plate sounds and delay (#4643) (diff) | |
download | cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar.gz cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar.bz2 cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar.lz cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar.xz cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.tar.zst cuberite-c9a9b3c9d0d4fed0b02d9935923bfd7dcbc45d1e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 3220992cb..6743a65d2 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -696,6 +696,10 @@ public: return GetStackValue(a_StackPos, a_ReturnedVal.GetDest()); } + /** Retrieves any Vector3 value and coerces it into a Vector3<T>. */ + template <typename T> + bool GetStackValue(int a_StackPos, Vector3<T> & a_ReturnedVal); + /** Pushes the named value in the table at the top of the stack. a_Name may be a path containing multiple table levels, such as "cChatColor.Blue". If the value is found, it is pushed on top of the stack and the returned cStackValue is valid. @@ -805,9 +809,14 @@ public: Returns false and logs a special warning ("wrong calling convention") if not. */ bool CheckParamStaticSelf(const char * a_SelfClassName); - bool IsParamUserType(int a_Param, AString a_UserType); + /** Returns true if the specified parameter is of the specified class. */ + bool IsParamUserType(int a_ParamIdx, AString a_UserType); - bool IsParamNumber(int a_Param); + /** Returns true if the specified parameter is a number. */ + bool IsParamNumber(int a_ParamIdx); + + /** Returns true if the specified parameter is any of the Vector3 types. */ + bool IsParamVector3(int a_ParamIdx); /** If the status is nonzero, prints the text on the top of Lua stack and returns true */ bool ReportErrors(int status); @@ -1027,7 +1036,12 @@ protected: /** Removes the specified reference from tracking. The reference will no longer be invalidated when this Lua state is about to be closed. */ void UntrackRef(cTrackedRef & a_Ref); -} ; +}; // cLuaState + +// Instantiate the GetStackValue(Vector3<>) function for all Vector3 types: +extern template bool cLuaState::GetStackValue(int a_StackPos, Vector3d & a_ReturnedVal); +extern template bool cLuaState::GetStackValue(int a_StackPos, Vector3f & a_ReturnedVal); +extern template bool cLuaState::GetStackValue(int a_StackPos, Vector3i & a_ReturnedVal); |