aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-09-07 16:35:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-09-07 16:35:04 -0300
commite3eabcf9134c0362facffde0305c18d992375913 (patch)
tree720f2eb38a16d9b7459bdc92008d97107379fba9
parent0df2238063f3e5b1a12c5272484f2afd45a2a2f1 (diff)
downloadlua-e3eabcf9134c0362facffde0305c18d992375913.tar.gz
lua-e3eabcf9134c0362facffde0305c18d992375913.tar.bz2
lua-e3eabcf9134c0362facffde0305c18d992375913.zip
'lua_[gs]etupvalue' may work even without debug information
(that is, without upvalue names)
-rw-r--r--lapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lapi.c b/lapi.c
index aacfd93c..40b15a3c 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.135 2010/09/03 14:14:01 roberto Exp roberto $ 2** $Id: lapi.c,v 2.136 2010/09/07 19:21:39 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1107,11 +1107,15 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val,
1107 return ""; 1107 return "";
1108 } 1108 }
1109 else { 1109 else {
1110 const char *name;
1110 Proto *p = f->l.p; 1111 Proto *p = f->l.p;
1111 if (!(1 <= n && n <= p->sizeupvalues)) return NULL; 1112 if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
1112 *val = f->l.upvals[n-1]->v; 1113 *val = f->l.upvals[n-1]->v;
1113 if (owner) *owner = obj2gco(f->l.upvals[n - 1]); 1114 if (owner) *owner = obj2gco(f->l.upvals[n - 1]);
1114 return getstr(p->upvalues[n-1].name); 1115 name = getstr(p->upvalues[n-1].name);
1116 if (name == NULL) /* no debug information? */
1117 name = "";
1118 return name;
1115 } 1119 }
1116} 1120}
1117 1121