diff options
| -rw-r--r-- | lua_cjson.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lua_cjson.c b/lua_cjson.c index 6c7eb4e..c0bdce1 100644 --- a/lua_cjson.c +++ b/lua_cjson.c | |||
| @@ -710,6 +710,8 @@ static void json_append_data(lua_State *l, json_config_t *cfg, | |||
| 710 | int current_depth, strbuf_t *json) | 710 | int current_depth, strbuf_t *json) |
| 711 | { | 711 | { |
| 712 | int len; | 712 | int len; |
| 713 | int as_array = 0; | ||
| 714 | int has_metatable; | ||
| 713 | 715 | ||
| 714 | switch (lua_type(l, -1)) { | 716 | switch (lua_type(l, -1)) { |
| 715 | case LUA_TSTRING: | 717 | case LUA_TSTRING: |
| @@ -728,8 +730,7 @@ static void json_append_data(lua_State *l, json_config_t *cfg, | |||
| 728 | current_depth++; | 730 | current_depth++; |
| 729 | json_check_encode_depth(l, cfg, current_depth, json); | 731 | json_check_encode_depth(l, cfg, current_depth, json); |
| 730 | 732 | ||
| 731 | int as_array = 0; | 733 | has_metatable = lua_getmetatable(l, -1); |
| 732 | int has_metatable = lua_getmetatable(l, -1); | ||
| 733 | 734 | ||
| 734 | if (has_metatable) { | 735 | if (has_metatable) { |
| 735 | lua_pushlightuserdata(l, &json_array); | 736 | lua_pushlightuserdata(l, &json_array); |
