浏览代码

Use 'luaL_newmetatable' for 'setMetatable'

Ole 9 年之前
父节点
当前提交
9deb7e9e7b
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      lib/luwra/auxiliary.hpp

+ 1 - 5
lib/luwra/auxiliary.hpp

@@ -37,12 +37,8 @@ bool equal(State* state, int index1, int index2) {
  */
 static inline
 void setMetatable(State* state, const char* name) {
-#if LUA_VERSION_NUM <= 501
-	luaL_getmetatable(state, name);
+	luaL_newmetatable(state, name);
 	lua_setmetatable(state, -2);
-#else
-	luaL_setmetatable(state, name);
-#endif
 }
 
 /**