Fixed Lua Vector unification. (#4652)
This commit is contained in:
parent
c9a9b3c9d0
commit
f84bab3bc2
@ -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)
|
bool cLuaState::CheckParamUUID(int a_StartParam, int a_EndParam)
|
||||||
{
|
{
|
||||||
ASSERT(IsValid());
|
ASSERT(IsValid());
|
||||||
|
@ -798,6 +798,10 @@ public:
|
|||||||
Accepts either cUUID instances or strings that contain UUIDs */
|
Accepts either cUUID instances or strings that contain UUIDs */
|
||||||
bool CheckParamUUID(int a_StartParam, int a_EndParam = -1);
|
bool CheckParamUUID(int a_StartParam, int a_EndParam = -1);
|
||||||
|
|
||||||
|
/** Returns true if the specified parameters on the stack are Vector3s; also logs warning if not.
|
||||||
|
Accepts any Vector3 type instances or tables. */
|
||||||
|
bool CheckParamVector3(int a_StartParam, int a_EndParam = -1);
|
||||||
|
|
||||||
/** Returns true if the specified parameter on the stack is nil (indicating an end-of-parameters) */
|
/** Returns true if the specified parameter on the stack is nil (indicating an end-of-parameters) */
|
||||||
bool CheckParamEnd(int a_Param);
|
bool CheckParamEnd(int a_Param);
|
||||||
|
|
||||||
|
@ -2967,7 +2967,7 @@ static int tolua_cLineBlockTracer_FirstSolidHitTrace(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
// This is the Vector3-based variant of the call:
|
// This is the Vector3-based variant of the call:
|
||||||
if (
|
if (
|
||||||
!L.CheckParamUserType(idx + 1, "Vector3<double>", idx + 2) ||
|
!L.CheckParamVector3(idx + 1, idx + 2) ||
|
||||||
!L.CheckParamEnd(idx + 3)
|
!L.CheckParamEnd(idx + 3)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -3061,11 +3061,11 @@ static int tolua_cLineBlockTracer_LineOfSightTrace(lua_State * tolua_S)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (L.IsParamUserType(idx + 1, "Vector3<double>"))
|
if (L.IsParamVector3(idx + 1))
|
||||||
{
|
{
|
||||||
// This is the Vector3d-based variant of the call:
|
// This is the Vector3-based variant of the call:
|
||||||
if (
|
if (
|
||||||
!L.CheckParamUserType(idx + 1, "Vector3<double>", idx + 2) ||
|
!L.CheckParamVector3(idx + 1, idx + 2) ||
|
||||||
// Optional param lineOfSight is not checked
|
// Optional param lineOfSight is not checked
|
||||||
!L.CheckParamEnd(idx + 4)
|
!L.CheckParamEnd(idx + 4)
|
||||||
)
|
)
|
||||||
@ -3089,7 +3089,7 @@ static int tolua_cLineBlockTracer_LineOfSightTrace(lua_State * tolua_S)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tolua_error(L, "cLineBlockTracer:LineOfSightTrace(): Invalid parameters, expected either a set of coords, or two Vector3d's", nullptr);
|
tolua_error(L, "cLineBlockTracer:LineOfSightTrace(): Invalid parameters, expected either a set of coords, or two Vector3's", nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user