summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-15 01:23:24 +0200
committerGitHub <noreply@github.com>2020-04-15 01:23:24 +0200
commitf84bab3bc21be6a8f574a8e4a590cb540dee2fd5 (patch)
treed929b8b3c2567160f61c572492787869f52101b3 /src/Bindings/LuaState.cpp
parentBindings: Allow coercion between Vector3 subtypes. (#4646) (diff)
downloadcuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar.gz
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar.bz2
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar.lz
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar.xz
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.tar.zst
cuberite-f84bab3bc21be6a8f574a8e4a590cb540dee2fd5.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 0541af793..b7f5f17e0 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -1877,6 +1877,32 @@ bool cLuaState::CheckParamFunctionOrNil(int a_StartParam, int a_EndParam)
+bool cLuaState::CheckParamVector3(int a_StartParam, int a_EndParam)
+{
+ ASSERT(IsValid());
+
+ if (a_EndParam < 0)
+ {
+ a_EndParam = a_StartParam;
+ }
+
+ for (int i = a_StartParam; i <= a_EndParam; ++i)
+ {
+ if (IsParamVector3(a_StartParam))
+ {
+ continue;
+ }
+
+ ApiParamError("Failed to read parameter #%d. Vector3 expected, got %s", i, GetTypeText(i).c_str());
+ return false;
+ }
+ return true;
+}
+
+
+
+
+
bool cLuaState::CheckParamUUID(int a_StartParam, int a_EndParam)
{
ASSERT(IsValid());