From 3a29087cb7d08a2693c9eecd82cf2ce13551e450 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 2 Jan 2015 10:52:22 -0200 Subject: 'lua_setlocal' should not pop value when failing (to be consistent with the manual and with 'lua_setupvalue') --- ldebug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 577114e6..93bfc002 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 2.108 2014/12/08 15:48:23 roberto Exp roberto $ +** $Id: ldebug.c,v 2.109 2014/12/10 11:30:09 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -167,9 +167,10 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { StkId pos = 0; /* to avoid warnings */ const char *name = findlocal(L, ar->i_ci, n, &pos); lua_lock(L); - if (name) + if (name) { setobjs2s(L, pos, L->top - 1); - L->top--; /* pop value */ + L->top--; /* pop value */ + } lua_unlock(L); return name; } -- cgit v1.2.3-55-g6feb