mirror of https://github.com/rusefi/lua.git
'lua_[gs]etupvalue' may work even without debug information
(that is, without upvalue names)
This commit is contained in:
parent
0df2238063
commit
e3eabcf913
8
lapi.c
8
lapi.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.135 2010/09/03 14:14:01 roberto Exp roberto $
|
** $Id: lapi.c,v 2.136 2010/09/07 19:21:39 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -1107,11 +1107,15 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val,
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const char *name;
|
||||||
Proto *p = f->l.p;
|
Proto *p = f->l.p;
|
||||||
if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
|
if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
|
||||||
*val = f->l.upvals[n-1]->v;
|
*val = f->l.upvals[n-1]->v;
|
||||||
if (owner) *owner = obj2gco(f->l.upvals[n - 1]);
|
if (owner) *owner = obj2gco(f->l.upvals[n - 1]);
|
||||||
return getstr(p->upvalues[n-1].name);
|
name = getstr(p->upvalues[n-1].name);
|
||||||
|
if (name == NULL) /* no debug information? */
|
||||||
|
name = "";
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue