mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
From Lua 5.2: debug.getupvalue() returns "" for C function upvalues.
This commit is contained in:
parent
ead325b0c9
commit
998c656dc4
@ -176,15 +176,15 @@ LJLIB_CF(debug_setlocal)
|
|||||||
static int debug_getupvalue(lua_State *L, int get)
|
static int debug_getupvalue(lua_State *L, int get)
|
||||||
{
|
{
|
||||||
int32_t n = lj_lib_checkint(L, 2);
|
int32_t n = lj_lib_checkint(L, 2);
|
||||||
if (isluafunc(lj_lib_checkfunc(L, 1))) {
|
const char *name;
|
||||||
const char *name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
|
lj_lib_checkfunc(L, 1);
|
||||||
if (name) {
|
name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
|
||||||
lua_pushstring(L, name);
|
if (name) {
|
||||||
if (!get) return 1;
|
lua_pushstring(L, name);
|
||||||
copyTV(L, L->top, L->top-2);
|
if (!get) return 1;
|
||||||
L->top++;
|
copyTV(L, L->top, L->top-2);
|
||||||
return 2;
|
L->top++;
|
||||||
}
|
return 2;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user