diff options
| author | Mike Pall <mike> | 2012-09-19 12:08:35 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2012-09-19 12:08:35 +0200 |
| commit | c687d01c465ba10927ddec22bdbecc533c05dfbe (patch) | |
| tree | c5e45af5467e3cf0a109aa65ee217b1e43a3cc5e /src/lib_debug.c | |
| parent | 7d49b19ad01b14d5547b888db9a31ad86f7f735f (diff) | |
| download | luajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.tar.gz luajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.tar.bz2 luajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.zip | |
From Lua 5.2: debug.getlocal() accepts function arg, too.
Diffstat (limited to 'src/lib_debug.c')
| -rw-r--r-- | src/lib_debug.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c index 740708cf..f6818bbf 100644 --- a/src/lib_debug.c +++ b/src/lib_debug.c | |||
| @@ -145,9 +145,15 @@ LJLIB_CF(debug_getlocal) | |||
| 145 | lua_State *L1 = getthread(L, &arg); | 145 | lua_State *L1 = getthread(L, &arg); |
| 146 | lua_Debug ar; | 146 | lua_Debug ar; |
| 147 | const char *name; | 147 | const char *name; |
| 148 | int slot = lj_lib_checkint(L, arg+2); | ||
| 149 | if (tvisfunc(L->base+arg)) { | ||
| 150 | L->top = L->base+arg+1; | ||
| 151 | lua_pushstring(L, lua_getlocal(L, NULL, slot)); | ||
| 152 | return 1; | ||
| 153 | } | ||
| 148 | if (!lua_getstack(L1, lj_lib_checkint(L, arg+1), &ar)) | 154 | if (!lua_getstack(L1, lj_lib_checkint(L, arg+1), &ar)) |
| 149 | lj_err_arg(L, arg+1, LJ_ERR_LVLRNG); | 155 | lj_err_arg(L, arg+1, LJ_ERR_LVLRNG); |
| 150 | name = lua_getlocal(L1, &ar, lj_lib_checkint(L, arg+2)); | 156 | name = lua_getlocal(L1, &ar, slot); |
| 151 | if (name) { | 157 | if (name) { |
| 152 | lua_xmove(L1, L, 1); | 158 | lua_xmove(L1, L, 1); |
| 153 | lua_pushstring(L, name); | 159 | lua_pushstring(L, name); |
