tcpsock:send table时, 为何要去检查 非数组? 直接发送从1到首个nil元素为止 更简单.
另一种场景:table.concat 也没有检查 非数组元素

    2 months later

    stallion5632
    ngx_http_lua_calc_strlen_in_table(): non-array table found

        lua_pushnil(L); /* stack: table key */
        while (lua_next(L, index) != 0) { /* stack: table key value */
            dd("key type: %s", luaL_typename(L, -2));
    
            if (lua_type(L, -2) == LUA_TNUMBER) {
    
                key = lua_tonumber(L, -2);
    
                dd("key value: %d", (int) key);
    
                if (floor(key) == key && key >= 1) {
                    if (key > max) {
                        max = (int) key;
                    }
    
                    lua_pop(L, 1); /* stack: table key */
                    continue;
                }
            }
    
            /* not an array (non positive integer key) */
            lua_pop(L, 2); /* stack: table */
    
            luaL_argerror(L, arg_i, "non-array table found");
            return 0;
        }
      Write a Reply...