aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-30 10:38:50 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-30 10:38:50 -0200
commitf379d06e24f22cb4d0afa3937c27ef35b73b00a6 (patch)
treee87e3def52e622040ec2724433e21daee8322ee3 /ldebug.c
parent728ff2070135b54c544b90020be268f53bf2d15a (diff)
downloadlua-f379d06e24f22cb4d0afa3937c27ef35b73b00a6.tar.gz
lua-f379d06e24f22cb4d0afa3937c27ef35b73b00a6.tar.bz2
lua-f379d06e24f22cb4d0afa3937c27ef35b73b00a6.zip
all API functions are declared in a single line (to facilitate pre-processing).
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/ldebug.c b/ldebug.c
index 744263a6..b3d2dfac 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.48 2000/10/20 16:39:03 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.49 2000/10/27 11:39:52 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -148,29 +148,27 @@ static Proto *getluaproto (StkId f) {
148} 148}
149 149
150 150
151LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, 151LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
152 int localnum) {
153 const char *name; 152 const char *name;
154 StkId f = ar->_func; 153 StkId f = ar->_func;
155 Proto *fp = getluaproto(f); 154 Proto *fp = getluaproto(f);
156 if (!fp) return NULL; /* `f' is not a Lua function? */ 155 if (!fp) return NULL; /* `f' is not a Lua function? */
157 name = luaF_getlocalname(fp, localnum, currentpc(f)); 156 name = luaF_getlocalname(fp, n, currentpc(f));
158 if (!name) return NULL; 157 if (!name) return NULL;
159 luaA_pushobject(L, (f+1)+(localnum-1)); /* push value */ 158 luaA_pushobject(L, (f+1)+(n-1)); /* push value */
160 return name; 159 return name;
161} 160}
162 161
163 162
164LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, 163LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
165 int localnum) {
166 const char *name; 164 const char *name;
167 StkId f = ar->_func; 165 StkId f = ar->_func;
168 Proto *fp = getluaproto(f); 166 Proto *fp = getluaproto(f);
169 L->top--; /* pop new value */ 167 L->top--; /* pop new value */
170 if (!fp) return NULL; /* `f' is not a Lua function? */ 168 if (!fp) return NULL; /* `f' is not a Lua function? */
171 name = luaF_getlocalname(fp, localnum, currentpc(f)); 169 name = luaF_getlocalname(fp, n, currentpc(f));
172 if (!name || name[0] == '(') return NULL; /* `(' starts private locals */ 170 if (!name || name[0] == '(') return NULL; /* `(' starts private locals */
173 *((f+1)+(localnum-1)) = *L->top; 171 *((f+1)+(n-1)) = *L->top;
174 return name; 172 return name;
175} 173}
176 174