mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: See #1484
This commit is contained in:
@@ -512,17 +512,26 @@ pack_meta_dict(lua_State *L, struct bson *b, int depth) {
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_rawarray(lua_State *L) {
|
is_rawarray(lua_State *L) {
|
||||||
|
// test first key, hash part first in Lua 5.4
|
||||||
|
lua_pushnil(L);
|
||||||
|
if (lua_next(L, -2) == 0) {
|
||||||
|
// empty table
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lua_Integer firstkey = lua_tointeger(L, -2);
|
||||||
|
lua_pop(L, 2);
|
||||||
|
if (firstkey != 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
size_t len = lua_rawlen(L, -1);
|
size_t len = lua_rawlen(L, -1);
|
||||||
if (len > 0) {
|
|
||||||
lua_pushinteger(L, len);
|
lua_pushinteger(L, len);
|
||||||
if (lua_next(L,-2) == 0) {
|
if (lua_next(L,-2) == 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
lua_pop(L,2);
|
lua_pop(L,2);
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_table(struct bson *bs, lua_State *L, const char *key, size_t sz, int depth) {
|
append_table(struct bson *bs, lua_State *L, const char *key, size_t sz, int depth) {
|
||||||
|
|||||||
Reference in New Issue
Block a user