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/lj_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 '')
-rw-r--r-- | src/lj_debug.c | 12 |
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) | |||
401 | LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n) | 401 | LUA_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 | } |