aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 35622402..1cd2e335 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.184 2005/10/03 14:36:45 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.185 2005/10/20 11:35:50 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*/
@@ -340,12 +340,10 @@ static int luaB_assert (lua_State *L) {
340 340
341 341
342static int luaB_unpack (lua_State *L) { 342static int luaB_unpack (lua_State *L) {
343 int i = luaL_optint(L, 2, 1); 343 int i, e, n;
344 int e = luaL_optint(L, 3, -1);
345 int n;
346 luaL_checktype(L, 1, LUA_TTABLE); 344 luaL_checktype(L, 1, LUA_TTABLE);
347 if (e == -1) 345 i = luaL_optint(L, 2, 1);
348 e = luaL_getn(L, 1); 346 e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
349 n = e - i + 1; /* number of elements */ 347 n = e - i + 1; /* number of elements */
350 if (n <= 0) return 0; /* empty range */ 348 if (n <= 0) return 0; /* empty range */
351 luaL_checkstack(L, n, "table too big to unpack"); 349 luaL_checkstack(L, n, "table too big to unpack");