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