Kaynağa Gözat

Fix optional argument handling in table.concat().

Mike Pall 12 yıl önce
ebeveyn
işleme
b030788401
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      src/lib_table.c

+ 2 - 2
src/lib_table.c

@@ -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 (;;) {