aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-09-19 12:03:03 +0200
committerMike Pall <mike>2012-09-19 12:03:03 +0200
commit998c656dc46e03ed005bb795c3640e56c305b0a5 (patch)
tree7d73f74cf335332c57a6f900bda62157df78c851 /src
parentead325b0c9deafb23f499f9739acca3bb36c3e46 (diff)
downloadluajit-998c656dc46e03ed005bb795c3640e56c305b0a5.tar.gz
luajit-998c656dc46e03ed005bb795c3640e56c305b0a5.tar.bz2
luajit-998c656dc46e03ed005bb795c3640e56c305b0a5.zip
From Lua 5.2: debug.getupvalue() returns "" for C function upvalues.
Diffstat (limited to 'src')
-rw-r--r--src/lib_debug.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c
index f9b7a478..740708cf 100644
--- a/src/lib_debug.c
+++ b/src/lib_debug.c
@@ -176,15 +176,15 @@ LJLIB_CF(debug_setlocal)
176static int debug_getupvalue(lua_State *L, int get) 176static int debug_getupvalue(lua_State *L, int get)
177{ 177{
178 int32_t n = lj_lib_checkint(L, 2); 178 int32_t n = lj_lib_checkint(L, 2);
179 if (isluafunc(lj_lib_checkfunc(L, 1))) { 179 const char *name;
180 const char *name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); 180 lj_lib_checkfunc(L, 1);
181 if (name) { 181 name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
182 lua_pushstring(L, name); 182 if (name) {
183 if (!get) return 1; 183 lua_pushstring(L, name);
184 copyTV(L, L->top, L->top-2); 184 if (!get) return 1;
185 L->top++; 185 copyTV(L, L->top, L->top-2);
186 return 2; 186 L->top++;
187 } 187 return 2;
188 } 188 }
189 return 0; 189 return 0;
190} 190}