aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-12 11:32:27 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-12 11:32:27 -0200
commitcb59019f580ae0cb863cbf903efae28cf67c33af (patch)
tree8d602c2b6cb4a6a2e3399e5c1e7d855e6f416b9b /lauxlib.c
parent52c0f9575b4253a8f3064158529dcedec3c9bffe (diff)
downloadlua-cb59019f580ae0cb863cbf903efae28cf67c33af.tar.gz
lua-cb59019f580ae0cb863cbf903efae28cf67c33af.tar.bz2
lua-cb59019f580ae0cb863cbf903efae28cf67c33af.zip
uses return value from luaL_getmetatable
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c5
1 files 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 @@
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
281LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { 281LUALIB_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 */