lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 90d016980f47fb4f760be2356e715f92af9a7af8
parent b3996c55f6991a6f11bf7ead2df48034a2d84e8a
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue,  3 Feb 2015 15:37:59 -0200

detail ('luaL_getmetatable' does not return a boolean, but a tag)

Diffstat:
Mlauxlib.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lauxlib.c b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.278 2014/12/13 17:47:58 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.279 2014/12/14 18:32:26 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -286,7 +286,7 @@ LUALIB_API int luaL_execresult (lua_State *L, int stat) { */ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - if (luaL_getmetatable(L, tname)) /* name already in use? */ + if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ return 0; /* leave previous value on top, but return 0 */ lua_pop(L, 1); lua_newtable(L); /* create metatable */