diff options
-rw-r--r-- | lapi.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.233 2014/08/01 17:33:08 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.234 2014/08/21 20:07:56 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -676,7 +676,7 @@ LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { | |||
676 | LUA_API int lua_getmetatable (lua_State *L, int objindex) { | 676 | LUA_API int lua_getmetatable (lua_State *L, int objindex) { |
677 | const TValue *obj; | 677 | const TValue *obj; |
678 | Table *mt = NULL; | 678 | Table *mt = NULL; |
679 | int res; | 679 | int res = 0; |
680 | lua_lock(L); | 680 | lua_lock(L); |
681 | obj = index2addr(L, objindex); | 681 | obj = index2addr(L, objindex); |
682 | switch (ttnov(obj)) { | 682 | switch (ttnov(obj)) { |
@@ -690,9 +690,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
690 | mt = G(L)->mt[ttnov(obj)]; | 690 | mt = G(L)->mt[ttnov(obj)]; |
691 | break; | 691 | break; |
692 | } | 692 | } |
693 | if (mt == NULL) | 693 | if (mt != NULL) { |
694 | res = 0; | ||
695 | else { | ||
696 | sethvalue(L, L->top, mt); | 694 | sethvalue(L, L->top, mt); |
697 | api_incr_top(L); | 695 | api_incr_top(L); |
698 | res = 1; | 696 | res = 1; |