aboutsummaryrefslogtreecommitdiff
path: root/src/lj_debug.c
diff options
context:
space:
mode:
authorMike Pall <mike>2012-09-19 12:08:35 +0200
committerMike Pall <mike>2012-09-19 12:08:35 +0200
commitc687d01c465ba10927ddec22bdbecc533c05dfbe (patch)
treec5e45af5467e3cf0a109aa65ee217b1e43a3cc5e /src/lj_debug.c
parent7d49b19ad01b14d5547b888db9a31ad86f7f735f (diff)
downloadluajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.tar.gz
luajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.tar.bz2
luajit-c687d01c465ba10927ddec22bdbecc533c05dfbe.zip
From Lua 5.2: debug.getlocal() accepts function arg, too.
Diffstat (limited to '')
-rw-r--r--src/lj_debug.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 85dbac50..d5693779 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -401,10 +401,14 @@ void lj_debug_pushloc(lua_State *L, GCproto *pt, BCPos pc)
401LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n) 401LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n)
402{ 402{
403 const char *name = NULL; 403 const char *name = NULL;
404 TValue *o = debug_localname(L, ar, &name, (BCReg)n); 404 if (ar) {
405 if (name) { 405 TValue *o = debug_localname(L, ar, &name, (BCReg)n);
406 copyTV(L, L->top, o); 406 if (name) {
407 incr_top(L); 407 copyTV(L, L->top, o);
408 incr_top(L);
409 }
410 } else if (tvisfunc(L->top-1) && isluafunc(funcV(L->top-1))) {
411 name = debug_varname(funcproto(funcV(L->top-1)), 0, (BCReg)n-1);
408 } 412 }
409 return name; 413 return name;
410} 414}