diff options
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.79 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.80 2015/01/13 16:27:29 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -215,10 +215,10 @@ static int unpack (lua_State *L) { | |||
215 | n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ | 215 | n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ |
216 | if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) | 216 | if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) |
217 | return luaL_error(L, "too many results to unpack"); | 217 | return luaL_error(L, "too many results to unpack"); |
218 | do { /* must have at least one element */ | 218 | for (; i < e; i++) { /* push arg[i..e - 1] (to avoid overflows) */ |
219 | (*ta.geti)(L, 1, i); /* push arg[i..e] */ | 219 | (*ta.geti)(L, 1, i); |
220 | } while (i++ < e); | 220 | } |
221 | 221 | (*ta.geti)(L, 1, e); /* push last element */ | |
222 | return (int)n; | 222 | return (int)n; |
223 | } | 223 | } |
224 | 224 | ||