|
@@ -28,34 +28,40 @@ bool LuaStack::is_matrix4x4(int i)
|
|
|
Vector3 *LuaStack::check_temporary(int i, const Vector3 *ptr)
|
|
Vector3 *LuaStack::check_temporary(int i, const Vector3 *ptr)
|
|
|
{
|
|
{
|
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
|
- if (CE_UNLIKELY(!env->is_vector3(ptr))) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Vector3 *v = env->check_valid(ptr);
|
|
|
|
|
+ if (CE_UNLIKELY(!env->is_vector3(v))) {
|
|
|
luaL_typerror(L, i, "Vector3");
|
|
luaL_typerror(L, i, "Vector3");
|
|
|
CE_UNREACHABLE();
|
|
CE_UNREACHABLE();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return env->check_valid(ptr);
|
|
|
|
|
|
|
+ return v;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Quaternion *LuaStack::check_temporary(int i, const Quaternion *ptr)
|
|
Quaternion *LuaStack::check_temporary(int i, const Quaternion *ptr)
|
|
|
{
|
|
{
|
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
|
- if (CE_UNLIKELY(!env->is_quaternion(ptr))) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Quaternion *q = env->check_valid(ptr);
|
|
|
|
|
+ if (CE_UNLIKELY(!env->is_quaternion(q))) {
|
|
|
luaL_typerror(L, i, "Quaternion");
|
|
luaL_typerror(L, i, "Quaternion");
|
|
|
CE_UNREACHABLE();
|
|
CE_UNREACHABLE();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return env->check_valid(ptr);
|
|
|
|
|
|
|
+ return q;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Matrix4x4 *LuaStack::check_temporary(int i, const Matrix4x4 *ptr)
|
|
Matrix4x4 *LuaStack::check_temporary(int i, const Matrix4x4 *ptr)
|
|
|
{
|
|
{
|
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
LuaEnvironment *env = device()->_lua_environment;
|
|
|
- if (CE_UNLIKELY(!env->is_matrix4x4(ptr))) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Matrix4x4 *m = env->check_valid(ptr);
|
|
|
|
|
+ if (CE_UNLIKELY(!env->is_matrix4x4(m))) {
|
|
|
luaL_typerror(L, i, "Matrix4x4");
|
|
luaL_typerror(L, i, "Matrix4x4");
|
|
|
CE_UNREACHABLE();
|
|
CE_UNREACHABLE();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return env->check_valid(ptr);
|
|
|
|
|
|
|
+ return m;
|
|
|
}
|
|
}
|
|
|
#endif // if CROWN_DEBUG
|
|
#endif // if CROWN_DEBUG
|
|
|
|
|
|