'lua_setlocal' should not pop value when failing (to be consistent
with the manual and with 'lua_setupvalue')
This commit is contained in:
7
ldebug.c
7
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user