commit e3eabcf9134c0362facffde0305c18d992375913
parent 0df2238063f3e5b1a12c5272484f2afd45a2a2f1
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 7 Sep 2010 16:34:40 -0300
'lua_[gs]etupvalue' may work even without debug information
(that is, without upvalue names)
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lapi.c b/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
** See Copyright Notice in lua.h
*/
@@ -1107,11 +1107,15 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val,
return "";
}
else {
+ const char *name;
Proto *p = f->l.p;
if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
*val = f->l.upvals[n-1]->v;
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;
}
}