first key can't can be in hash part, see
@@ -519,8 +519,11 @@ is_rawarray(lua_State *L) {
}
lua_Integer firstkey = lua_isinteger(L, -2) ? lua_tointeger(L, -2) : 0;
lua_pop(L, 2);
+ if (firstkey <= 1) {
return firstkey > 0;
}
+ return firstkey <= lua_rawlen(L, -1);
+}
static void
append_table(struct bson *bs, lua_State *L, const char *key, size_t sz, int depth) {
