From 538414408d47af80b29e370db6b512807552b0c4 Mon Sep 17 00:00:00 2001 From: cxj Date: Mon, 13 Jul 2015 13:04:09 +0800 Subject: [PATCH] sharedata serialization bugfix --- examples/share.lua | 2 +- lualib-src/lua-seri.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/share.lua b/examples/share.lua index 2721d480..8bc4b497 100644 --- a/examples/share.lua +++ b/examples/share.lua @@ -43,7 +43,7 @@ skynet.start(function() for k,v in pairs(nobj) do skynet.error(string.format("nobj[%s]=%s", k,v)) end - for k,v in ipairs(nobj) do + for k,v in ipairs(nobj.b) do skynet.error(string.format("nobj.b[%d]=%s", k,v)) end diff --git a/lualib-src/lua-seri.c b/lualib-src/lua-seri.c index 0db2267d..c0761bd5 100644 --- a/lualib-src/lua-seri.c +++ b/lualib-src/lua-seri.c @@ -266,8 +266,10 @@ wb_table_metapairs(lua_State *L, struct write_block *wb, int index, int depth) { lua_copy(L, -5, -3); lua_call(L, 2, 2); int type = lua_type(L, -2); - if (type == LUA_TNIL) + if (type == LUA_TNIL) { + lua_pop(L, 4); break; + } pack_one(L, wb, -2, depth); pack_one(L, wb, -1, depth); lua_pop(L, 1);