From cb59019f580ae0cb863cbf903efae28cf67c33af Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 12 Nov 2014 11:32:27 -0200 Subject: [PATCH] uses return value from luaL_getmetatable --- lauxlib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index 865006d8..a593fc19 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.272 2014/10/29 16:11:17 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.273 2014/11/02 19:19:04 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -279,8 +279,7 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) { */ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - luaL_getmetatable(L, tname); /* try to get metatable */ - if (!lua_isnil(L, -1)) /* name already in use? */ + if (luaL_getmetatable(L, tname)) /* name already in use? */ return 0; /* leave previous value on top, but return 0 */ lua_pop(L, 1); lua_newtable(L); /* create metatable */