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

Function json_cfg_encode_sparse_array

engine/script/src/luacjson/lua_cjson.c:319–328  ·  view source on GitHub ↗

Configures handling of extremely sparse arrays: * convert: Convert extremely sparse arrays into objects? Otherwise error. * ratio: 0: always allow sparse; 1: never allow sparse; >1: use ratio * safe: Always use an array when the max index <= safe */

Source from the content-addressed store, hash-verified

317 * ratio: 0: always allow sparse; 1: never allow sparse; >1: use ratio
318 * safe: Always use an array when the max index <= safe */
319static int json_cfg_encode_sparse_array(lua_State *l)
320{
321 json_config_t *cfg = json_arg_init(l, 3);
322
323 json_enum_option(l, 1, &cfg->encode_sparse_convert, NULL, 1);
324 json_integer_option(l, 2, &cfg->encode_sparse_ratio, 0, INT_MAX);
325 json_integer_option(l, 3, &cfg->encode_sparse_safe, 0, INT_MAX);
326
327 return 3;
328}
329
330/* Configures the maximum number of nested arrays/objects allowed when
331 * encoding */

Callers

nothing calls this directly

Calls 3

json_arg_initFunction · 0.85
json_enum_optionFunction · 0.85
json_integer_optionFunction · 0.85

Tested by

no test coverage detected