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