diff options
-rw-r--r-- | lauxlib.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.272 2014/10/29 16:11:17 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.273 2014/11/02 19:19:04 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -279,8 +279,7 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) { | |||
279 | */ | 279 | */ |
280 | 280 | ||
281 | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { | 281 | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { |
282 | luaL_getmetatable(L, tname); /* try to get metatable */ | 282 | if (luaL_getmetatable(L, tname)) /* name already in use? */ |
283 | if (!lua_isnil(L, -1)) /* name already in use? */ | ||
284 | return 0; /* leave previous value on top, but return 0 */ | 283 | return 0; /* leave previous value on top, but return 0 */ |
285 | lua_pop(L, 1); | 284 | lua_pop(L, 1); |
286 | lua_newtable(L); /* create metatable */ | 285 | lua_newtable(L); /* create metatable */ |