diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-02-27 12:59:22 -0300 |
| commit | 6eb53b752617fae9e1329bfe2cfecdcbb593c398 (patch) | |
| tree | c392ef632bbcfbf7b3716f5c6c17b06617bca8da /ldblib.c | |
| parent | 9b7987a9d1471ba94764286b28e0998f73deb46a (diff) | |
| download | lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.gz lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.tar.bz2 lua-6eb53b752617fae9e1329bfe2cfecdcbb593c398.zip | |
Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -202,8 +202,6 @@ static int db_getinfo (lua_State *L) { | |||
| 202 | static int db_getlocal (lua_State *L) { | 202 | static int db_getlocal (lua_State *L) { |
| 203 | int arg; | 203 | int arg; |
| 204 | lua_State *L1 = getthread(L, &arg); | 204 | lua_State *L1 = getthread(L, &arg); |
| 205 | lua_Debug ar; | ||
| 206 | const char *name; | ||
| 207 | int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ | 205 | int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ |
| 208 | if (lua_isfunction(L, arg + 1)) { /* function argument? */ | 206 | if (lua_isfunction(L, arg + 1)) { /* function argument? */ |
| 209 | lua_pushvalue(L, arg + 1); /* push function */ | 207 | lua_pushvalue(L, arg + 1); /* push function */ |
| @@ -211,6 +209,8 @@ static int db_getlocal (lua_State *L) { | |||
| 211 | return 1; /* return only name (there is no value) */ | 209 | return 1; /* return only name (there is no value) */ |
| 212 | } | 210 | } |
| 213 | else { /* stack-level argument */ | 211 | else { /* stack-level argument */ |
| 212 | lua_Debug ar; | ||
| 213 | const char *name; | ||
| 214 | int level = (int)luaL_checkinteger(L, arg + 1); | 214 | int level = (int)luaL_checkinteger(L, arg + 1); |
| 215 | if (!lua_getstack(L1, level, &ar)) /* out of range? */ | 215 | if (!lua_getstack(L1, level, &ar)) /* out of range? */ |
| 216 | return luaL_argerror(L, arg+1, "level out of range"); | 216 | return luaL_argerror(L, arg+1, "level out of range"); |
