Parcourir la Source

Use 'luaL_setmetatable' instead of retrieving and setting it manually

Ole il y a 10 ans
Parent
commit
336d790638
1 fichiers modifiés avec 1 ajouts et 4 suppressions
  1. 1 4
      lib/luwra/usertypes.hpp

+ 1 - 4
lib/luwra/usertypes.hpp

@@ -67,10 +67,7 @@ namespace internal {
 	 */
 	template <typename U> static inline
 	void apply_user_type_meta_table(State* state) {
-		using T = StripUserType<U>;
-
-		luaL_getmetatable(state, UserTypeReg<T>::name.c_str());
-		lua_setmetatable(state, -2);
+		luaL_setmetatable(state, UserTypeReg<StripUserType<U>>::name.c_str());
 	}
 
 	/**