From c5fb93823acf1c373d3c3795fcf6ac0d383a5fd0 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 20 Apr 2016 10:11:55 +0800 Subject: [PATCH] update sproto, fix bug in sproto.default --- lualib-src/sproto/lsproto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lualib-src/sproto/lsproto.c b/lualib-src/sproto/lsproto.c index 3a70a6d4..c7708fed 100644 --- a/lualib-src/sproto/lsproto.c +++ b/lualib-src/sproto/lsproto.c @@ -604,6 +604,8 @@ encode_default(const struct sproto_arg *args) { lua_pushstring(L, args->tagname); if (args->index > 0) { lua_newtable(L); + lua_rawset(L, -3); + return SPROTO_CB_NOARRAY; } else { switch(args->type) { case SPROTO_TINTEGER: @@ -621,9 +623,9 @@ encode_default(const struct sproto_arg *args) { lua_setfield(L, -2, "__type"); break; } + lua_rawset(L, -3); + return SPROTO_CB_NIL; } - lua_rawset(L, -3); - return 0; } /*