diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-02 17:43:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-02 17:43:18 -0300 |
commit | 49c95648a003ea75577c1292c4530cdb798eac02 (patch) | |
tree | f61ebfed6514088638e78fa40991158cbb6bcdea /lapi.c | |
parent | 13ab5a6bb1258d640bda2e6d776d5a38f3fa867b (diff) | |
download | lua-49c95648a003ea75577c1292c4530cdb798eac02.tar.gz lua-49c95648a003ea75577c1292c4530cdb798eac02.tar.bz2 lua-49c95648a003ea75577c1292c4530cdb798eac02.zip |
getmetatable doesn't push nil when there is no metatable
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.180 2002/03/26 20:46:10 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.181 2002/03/27 12:49:53 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 | */ |
@@ -416,15 +416,13 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
416 | default: | 416 | default: |
417 | mt = hvalue(defaultmeta(L)); | 417 | mt = hvalue(defaultmeta(L)); |
418 | } | 418 | } |
419 | if (mt == hvalue(defaultmeta(L))) { | 419 | if (mt == hvalue(defaultmeta(L))) |
420 | setnilvalue(L->top); | ||
421 | res = 0; | 420 | res = 0; |
422 | } | ||
423 | else { | 421 | else { |
424 | sethvalue(L->top, mt); | 422 | sethvalue(L->top, mt); |
423 | api_incr_top(L); | ||
425 | res = 1; | 424 | res = 1; |
426 | } | 425 | } |
427 | api_incr_top(L); | ||
428 | lua_unlock(L); | 426 | lua_unlock(L); |
429 | return res; | 427 | return res; |
430 | } | 428 | } |