lua

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

commit 49c95648a003ea75577c1292c4530cdb798eac02
parent 13ab5a6bb1258d640bda2e6d776d5a38f3fa867b
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue,  2 Apr 2002 17:42:56 -0300

getmetatable doesn't push nil when there is no metatable

Diffstat:
Mlapi.c | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.180 2002/03/26 20:46:10 roberto Exp roberto $ +** $Id: lapi.c,v 1.181 2002/03/27 12:49:53 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -416,15 +416,13 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { default: mt = hvalue(defaultmeta(L)); } - if (mt == hvalue(defaultmeta(L))) { - setnilvalue(L->top); + if (mt == hvalue(defaultmeta(L))) res = 0; - } else { sethvalue(L->top, mt); + api_incr_top(L); res = 1; } - api_incr_top(L); lua_unlock(L); return res; }