diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-08-27 11:59:33 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-08-27 11:59:33 -0300 |
| commit | 9b25347a6752d27e7ff74a2ed82301ead1bc9a1b (patch) | |
| tree | bffaea5e9712ef833eb6fb63530706f78a887481 | |
| parent | e401513086792e27e2c07c2b503adf5e08492781 (diff) | |
| download | lua-9b25347a6752d27e7ff74a2ed82301ead1bc9a1b.tar.gz lua-9b25347a6752d27e7ff74a2ed82301ead1bc9a1b.tar.bz2 lua-9b25347a6752d27e7ff74a2ed82301ead1bc9a1b.zip | |
detail
| -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; |
