diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-01-02 10:52:22 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-01-02 10:52:22 -0200 |
| commit | 3a29087cb7d08a2693c9eecd82cf2ce13551e450 (patch) | |
| tree | e8c3c75357b07b8f7099f49073ad0a4fcce81d34 /ldebug.c | |
| parent | 234fb7f695f9e98fea40cc58b3cd2468e1ee0562 (diff) | |
| download | lua-3a29087cb7d08a2693c9eecd82cf2ce13551e450.tar.gz lua-3a29087cb7d08a2693c9eecd82cf2ce13551e450.tar.bz2 lua-3a29087cb7d08a2693c9eecd82cf2ce13551e450.zip | |
'lua_setlocal' should not pop value when failing (to be consistent
with the manual and with 'lua_setupvalue')
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.108 2014/12/08 15:48:23 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.109 2014/12/10 11:30:09 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -167,9 +167,10 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
| 167 | StkId pos = 0; /* to avoid warnings */ | 167 | StkId pos = 0; /* to avoid warnings */ |
| 168 | const char *name = findlocal(L, ar->i_ci, n, &pos); | 168 | const char *name = findlocal(L, ar->i_ci, n, &pos); |
| 169 | lua_lock(L); | 169 | lua_lock(L); |
| 170 | if (name) | 170 | if (name) { |
| 171 | setobjs2s(L, pos, L->top - 1); | 171 | setobjs2s(L, pos, L->top - 1); |
| 172 | L->top--; /* pop value */ | 172 | L->top--; /* pop value */ |
| 173 | } | ||
| 173 | lua_unlock(L); | 174 | lua_unlock(L); |
| 174 | return name; | 175 | return name; |
| 175 | } | 176 | } |
