commit 9b25347a6752d27e7ff74a2ed82301ead1bc9a1b
parent e401513086792e27e2c07c2b503adf5e08492781
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 27 Aug 2014 11:59:08 -0300
detail
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lapi.c b/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.233 2014/08/01 17:33:08 roberto Exp roberto $
+** $Id: lapi.c,v 2.234 2014/08/21 20:07:56 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -676,7 +676,7 @@ LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
LUA_API int lua_getmetatable (lua_State *L, int objindex) {
const TValue *obj;
Table *mt = NULL;
- int res;
+ int res = 0;
lua_lock(L);
obj = index2addr(L, objindex);
switch (ttnov(obj)) {
@@ -690,9 +690,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
mt = G(L)->mt[ttnov(obj)];
break;
}
- if (mt == NULL)
- res = 0;
- else {
+ if (mt != NULL) {
sethvalue(L, L->top, mt);
api_incr_top(L);
res = 1;