lua

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

commit 36ab1ee10c557efe625bfab76eeea9fc6e0b7ab9
parent 193ce46970dda16e129ebb28cae085ecf469d702
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 15 Jan 2010 14:23:34 -0200

__unm metamethod gets nil as its 2nd parameter

Diffstat:
Mlvm.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lvm.c b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.101 2009/11/25 15:27:51 roberto Exp roberto $ +** $Id: lvm.c,v 2.102 2009/12/17 16:20:01 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -157,6 +157,7 @@ static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, if (ttisnil(tm)) tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ if (ttisnil(tm)) return 0; + if (event == TM_UNM) p2 = luaO_nilobject; callTM(L, tm, p1, p2, res, 1); return 1; }