diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-28 14:17:53 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-28 14:17:53 -0300 |
| commit | ade585bdf9e286a0ec01796763ded6701c6b1a8f (patch) | |
| tree | a578c006fc70e54114e1056bbbf8a014ccc30721 /lbaselib.c | |
| parent | 04c41444e22740119d3c017830276d6590b09747 (diff) | |
| download | lua-ade585bdf9e286a0ec01796763ded6701c6b1a8f.tar.gz lua-ade585bdf9e286a0ec01796763ded6701c6b1a8f.tar.bz2 lua-ade585bdf9e286a0ec01796763ded6701c6b1a8f.zip | |
no more LUA_FIRSTINDEX
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.171 2005/03/16 16:58:41 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.172 2005/03/22 16:04:29 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -240,7 +240,7 @@ static int luaB_ipairs (lua_State *L) { | |||
| 240 | luaL_checktype(L, 1, LUA_TTABLE); | 240 | luaL_checktype(L, 1, LUA_TTABLE); |
| 241 | lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ | 241 | lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ |
| 242 | lua_pushvalue(L, 1); /* state, */ | 242 | lua_pushvalue(L, 1); /* state, */ |
| 243 | lua_pushinteger(L, LUA_FIRSTINDEX - 1); /* and initial value */ | 243 | lua_pushinteger(L, 0); /* and initial value */ |
| 244 | return 3; | 244 | return 3; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| @@ -340,12 +340,12 @@ static int luaB_getn (lua_State *L) { | |||
| 340 | 340 | ||
| 341 | 341 | ||
| 342 | static int luaB_unpack (lua_State *L) { | 342 | static int luaB_unpack (lua_State *L) { |
| 343 | int i = luaL_optint(L, 2, LUA_FIRSTINDEX); | 343 | int i = luaL_optint(L, 2, 1); |
| 344 | int e = luaL_optint(L, 3, -1); | 344 | int e = luaL_optint(L, 3, -1); |
| 345 | int n; | 345 | int n; |
| 346 | luaL_checktype(L, 1, LUA_TTABLE); | 346 | luaL_checktype(L, 1, LUA_TTABLE); |
| 347 | if (e == -1) | 347 | if (e == -1) |
| 348 | e = luaL_getn(L, 1) + LUA_FIRSTINDEX - 1; | 348 | e = luaL_getn(L, 1); |
| 349 | n = e - i + 1; /* number of elements */ | 349 | n = e - i + 1; /* number of elements */ |
| 350 | if (n <= 0) return 0; /* empty range */ | 350 | if (n <= 0) return 0; /* empty range */ |
| 351 | luaL_checkstack(L, n, "table too big to unpack"); | 351 | luaL_checkstack(L, n, "table too big to unpack"); |
