diff options
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 16 |
1 files changed, 7 insertions, 9 deletions
| @@ -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 | ||
| 151 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, | 151 | LUA_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 | ||
| 164 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, | 163 | LUA_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 | ||
