json_append_array args: * - lua_State * - JSON strbuf * - Size of passwd Lua array (top of stack) */
| 567 | * - JSON strbuf |
| 568 | * - Size of passwd Lua array (top of stack) */ |
| 569 | static void json_append_array(lua_State *l, json_config_t *cfg, int current_depth, |
| 570 | strbuf_t *json, int array_length) |
| 571 | { |
| 572 | int comma, i; |
| 573 | |
| 574 | strbuf_append_char(json, '['); |
| 575 | |
| 576 | comma = 0; |
| 577 | for (i = 1; i <= array_length; i++) { |
| 578 | if (comma) |
| 579 | strbuf_append_char(json, ','); |
| 580 | else |
| 581 | comma = 1; |
| 582 | |
| 583 | lua_rawgeti(l, -1, i); |
| 584 | json_append_data(l, cfg, current_depth, json); |
| 585 | lua_pop(l, 1); |
| 586 | } |
| 587 | |
| 588 | strbuf_append_char(json, ']'); |
| 589 | } |
| 590 | |
| 591 | static void json_append_number(lua_State *l, json_config_t *cfg, |
| 592 | strbuf_t *json, int lindex) |
no test coverage detected