MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / json_append_array

Function json_append_array

LuaSTGPlus/LuaExtensions/cjson4lua/lua_cjson.c:569–589  ·  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

567 * - JSON strbuf
568 * - Size of passwd Lua array (top of stack) */
569static 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
591static void json_append_number(lua_State *l, json_config_t *cfg,
592 strbuf_t *json, int lindex)

Callers 1

json_append_dataFunction · 0.85

Calls 2

strbuf_append_charFunction · 0.85
json_append_dataFunction · 0.85

Tested by

no test coverage detected