aboutsummaryrefslogtreecommitdiff
path: root/src/lib_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_debug.c')
-rw-r--r--src/lib_debug.c8
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);