Просмотр исходного кода

Remove redundant user type functions

Ole лет назад: 10
Родитель
Сommit
1586274713
2 измененных файлов с 0 добавлено и 21 удалено
  1. 0 17
      lib/luwra/usertypes.hpp
  2. 0 4
      tests/usertypes.cpp

+ 0 - 17
lib/luwra/usertypes.hpp

@@ -45,23 +45,6 @@ namespace internal {
 		luaL_newmetatable(state, user_type_reg_name<T>.c_str());
 	}
 
-	/**
-	 * Get the identifier for a user type at the given index.
-	 */
-	static inline
-	UserTypeID get_user_type_id(State* state, int index) {
-		if (!lua_isuserdata(state, index))
-			return nullptr;
-
-		if (lua_getmetatable(state, index)) {
-			UserTypeID type_id = lua_topointer(state, -1);
-			lua_pop(state, 1);
-			return type_id;
-		} else {
-			return nullptr;
-		}
-	}
-
 	/**
 	 * Check if the value at the given index if a user type T.
 	 */

+ 0 - 4
tests/usertypes.cpp

@@ -14,18 +14,14 @@ struct A {
 TEST_CASE("usertypes_registration") {
 	lua_State* state = luaL_newstate();
 
-	REQUIRE(luwra::internal::user_type_id<A> == (void*) INTPTR_MAX);
-
 	// Registration
 	luwra::register_user_type<A>(state, {});
-	REQUIRE(luwra::internal::user_type_id<A> != (void*) INTPTR_MAX);
 
 	// Reference
 	A* instance = new A;
 	luwra::Value<A*>::push(state, instance);
 
 	// Type checks
-	REQUIRE(luwra::internal::get_user_type_id(state, -1) == luwra::internal::user_type_id<A>);
 	REQUIRE(luwra::internal::check_user_type<A>(state, -1) == instance);
 	REQUIRE(luwra::Value<A*>::read(state, -1) == instance);