Fix optional argument handling in table.concat().

This commit is contained in:
Mike Pall 2013-05-08 11:05:43 +02:00
parent c5d7666ec8
commit b030788401

View File

@ -148,8 +148,8 @@ LJLIB_CF(table_concat)
GCstr *sep = lj_lib_optstr(L, 2);
MSize seplen = sep ? sep->len : 0;
int32_t i = lj_lib_optint(L, 3, 1);
int32_t e = L->base+3 < L->top ? lj_lib_checkint(L, 4) :
(int32_t)lj_tab_len(t);
int32_t e = (L->base+3 < L->top && !tvisnil(L->base+3)) ?
lj_lib_checkint(L, 4) : (int32_t)lj_tab_len(t);
luaL_buffinit(L, &b);
if (i <= e) {
for (;;) {