diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-03 14:42:42 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-03 14:42:42 -0200 |
commit | 80001ab0eb3ad95f370796b26dacfdd7e9874877 (patch) | |
tree | c6363a6e92c628474a8c45c69b0eb69e48e5ca01 | |
parent | ae29ab9858514eb264be590163c698d5172bbaa4 (diff) | |
download | lua-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.
-rw-r--r-- | bugs | 6 | ||||
-rw-r--r-- | lapi.c | 7 |
2 files changed, 9 insertions, 4 deletions
@@ -61,3 +61,9 @@ because "strtol" returns long, not unsigned long. | |||
61 | ** lstrlib.c | 61 | ** lstrlib.c |
62 | Mon Jan 4 10:41:40 EDT 1999 | 62 | Mon Jan 4 10:41:40 EDT 1999 |
63 | >> "format" does not check size of format item (such as "%00000...00000d"). | 63 | >> "format" does not check size of format item (such as "%00000...00000d"). |
64 | |||
65 | ** lapi.c | ||
66 | Wed Feb 3 14:40:21 EDT 1999 | ||
67 | >> getlocal cannot return the local itself, since lua_isstring and | ||
68 | lua_isnumber can modify it. | ||
69 | |||
@@ -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 | ||
501 | lua_Object lua_getlocal (lua_Function func, int local_number, char **name) | 501 | lua_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; |