MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / json_append_array

Function json_append_array

deps/lua/src/lua_cjson.c:566–586  ·  view source on GitHub ↗

json_append_array args: * - lua_State * - JSON strbuf * - Size of passwd Lua array (top of stack) */

Source from the content-addressed store, hash-verified

564 * - JSON strbuf
565 * - Size of passwd Lua array (top of stack) */
566static 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
588static void json_append_number(lua_State *l, json_config_t *cfg,
589 strbuf_t *json, int lindex)

Callers 1

json_append_dataFunction · 0.85

Calls 3

strbuf_append_charFunction · 0.85
lua_rawgetiFunction · 0.85
json_append_dataFunction · 0.85

Tested by

no test coverage detected