MCPcopy Create free account
hub / github.com/defold/defold / json_append_array

Function json_append_array

engine/script/src/luacjson/lua_cjson.c:745–765  ·  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

743 * - JSON strbuf
744 * - Size of passwd Lua array (top of stack) */
745static void json_append_array(lua_State *l, json_config_t *cfg, int current_depth,
746 strbuf_t *json, int array_length)
747{
748 int comma, i;
749
750 strbuf_append_char(json, '[');
751
752 comma = 0;
753 for (i = 1; i <= array_length; i++) {
754 if (comma)
755 strbuf_append_char(json, ',');
756 else
757 comma = 1;
758
759 lua_rawgeti(l, -1, i);
760 json_append_data(l, cfg, current_depth, json);
761 lua_pop(l, 1);
762 }
763
764 strbuf_append_char(json, ']');
765}
766
767static void json_append_number(lua_State *l, json_config_t *cfg,
768 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