diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:52:27 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:52:27 -0300 |
| commit | d396562b5ec0f14728e9a67fac7a7f7b845e1a20 (patch) | |
| tree | af36988ef62b16925bfa28632a17e000b06fc391 | |
| parent | 9d605982605db5ab8117b4cda71284bca2d25db8 (diff) | |
| download | lua-d396562b5ec0f14728e9a67fac7a7f7b845e1a20.tar.gz lua-d396562b5ec0f14728e9a67fac7a7f7b845e1a20.tar.bz2 lua-d396562b5ec0f14728e9a67fac7a7f7b845e1a20.zip | |
lua_equal also accepts out-of-range indices
| -rw-r--r-- | lapi.c | 7 |
1 files changed, 5 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.87 2000/08/14 19:10:14 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.88 2000/08/28 17:57:04 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 | */ |
| @@ -116,7 +116,10 @@ int lua_tag (lua_State *L, int index) { | |||
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | int lua_equal(lua_State *L, int index1, int index2) { | 118 | int lua_equal(lua_State *L, int index1, int index2) { |
| 119 | return luaO_equalObj(Index(L, index1), Index(L, index2)); | 119 | StkId o1 = Index(L, index1); |
| 120 | StkId o2 = Index(L, index2); | ||
| 121 | if (o1 >= L->top || o2 >= L->top) return 0; /* index out-of-range */ | ||
| 122 | else return luaO_equalObj(o1, o2); | ||
| 120 | } | 123 | } |
| 121 | 124 | ||
| 122 | 125 | ||
