aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-10 14:50:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-05-10 14:50:51 -0300
commit7e41612eb28ff0fba282bd419781fcbc9bd94776 (patch)
treee63123d15589435c08c844b0d471b142c924818b /lauxlib.c
parentb0f341ee52ee7d3d22261a68caf06eab5b0c8822 (diff)
downloadlua-7e41612eb28ff0fba282bd419781fcbc9bd94776.tar.gz
lua-7e41612eb28ff0fba282bd419781fcbc9bd94776.tar.bz2
lua-7e41612eb28ff0fba282bd419781fcbc9bd94776.zip
code parameterized by LUA_FIRSTINDEX (first index of an array)
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 9a8fe02b..6ff2940f 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.110 2004/03/23 16:38:43 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.111 2004/04/30 20:13:38 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -308,13 +308,13 @@ LUALIB_API int luaL_getn (lua_State *L, int t) {
308 if ((n = checkint(L, 2)) >= 0) return n; 308 if ((n = checkint(L, 2)) >= 0) return n;
309 lua_getfield(L, t, "n"); /* else try t.n */ 309 lua_getfield(L, t, "n"); /* else try t.n */
310 if ((n = checkint(L, 1)) >= 0) return n; 310 if ((n = checkint(L, 1)) >= 0) return n;
311 for (n = 1; ; n++) { /* else must count elements */ 311 for (n = LUA_FIRSTINDEX; ; n++) { /* else must count elements */
312 lua_rawgeti(L, t, n); 312 lua_rawgeti(L, t, n);
313 if (lua_isnil(L, -1)) break; 313 if (lua_isnil(L, -1)) break;
314 lua_pop(L, 1); 314 lua_pop(L, 1);
315 } 315 }
316 lua_pop(L, 1); 316 lua_pop(L, 1);
317 return n - 1; 317 return n - LUA_FIRSTINDEX;
318} 318}
319 319
320/* }====================================================== */ 320/* }====================================================== */