json_append_array args: * - lua_State * - JSON strbuf * - Size of passwd Lua array (top of stack) */
| 743 | * - JSON strbuf |
| 744 | * - Size of passwd Lua array (top of stack) */ |
| 745 | static void json_append_array(lua_State *l, json_config_t *cfg, int current_depth, |
| 746 | strbuf_t *json, int array_length) |
| 747 | { |
| 748 | int comma, i; |
| 749 | |
| 750 | strbuf_append_char(json, '['); |
| 751 | |
| 752 | comma = 0; |
| 753 | for (i = 1; i <= array_length; i++) { |
| 754 | if (comma) |
| 755 | strbuf_append_char(json, ','); |
| 756 | else |
| 757 | comma = 1; |
| 758 | |
| 759 | lua_rawgeti(l, -1, i); |
| 760 | json_append_data(l, cfg, current_depth, json); |
| 761 | lua_pop(l, 1); |
| 762 | } |
| 763 | |
| 764 | strbuf_append_char(json, ']'); |
| 765 | } |
| 766 | |
| 767 | static void json_append_number(lua_State *l, json_config_t *cfg, |
| 768 | strbuf_t *json, int lindex) |
no test coverage detected