aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-03 14:42:42 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-03 14:42:42 -0200
commit80001ab0eb3ad95f370796b26dacfdd7e9874877 (patch)
treec6363a6e92c628474a8c45c69b0eb69e48e5ca01 /lapi.c
parentae29ab9858514eb264be590163c698d5172bbaa4 (diff)
downloadlua-80001ab0eb3ad95f370796b26dacfdd7e9874877.tar.gz
lua-80001ab0eb3ad95f370796b26dacfdd7e9874877.tar.bz2
lua-80001ab0eb3ad95f370796b26dacfdd7e9874877.zip
getlocal cannot return the local itself, since lua_isstring and
lua_isnumber can modify it.
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index f89bb153..6a553422 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.31 1999/01/15 13:11:22 roberto Exp roberto $ 2** $Id: lapi.c,v 1.32 1999/01/26 15:31:17 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*/
@@ -498,8 +498,7 @@ int lua_currentline (lua_Function func)
498} 498}
499 499
500 500
501lua_Object lua_getlocal (lua_Function func, int local_number, char **name) 501lua_Object lua_getlocal (lua_Function func, int local_number, char **name) {
502{
503 /* check whether func is a Lua function */ 502 /* check whether func is a Lua function */
504 if (lua_tag(func) != LUA_T_PROTO) 503 if (lua_tag(func) != LUA_T_PROTO)
505 return LUA_NOOBJECT; 504 return LUA_NOOBJECT;
@@ -510,7 +509,7 @@ lua_Object lua_getlocal (lua_Function func, int local_number, char **name)
510 if (*name) { 509 if (*name) {
511 /* if "*name", there must be a LUA_T_LINE */ 510 /* if "*name", there must be a LUA_T_LINE */
512 /* therefore, f+2 points to function base */ 511 /* therefore, f+2 points to function base */
513 return Ref((f+2)+(local_number-1)); 512 return put_luaObject((f+2)+(local_number-1));
514 } 513 }
515 else 514 else
516 return LUA_NOOBJECT; 515 return LUA_NOOBJECT;