MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / ckpt_json_array_element

Function ckpt_json_array_element

common/script/json_api.cpp:158–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void ckpt_json_array_element(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs)
159{
160 const ScriptArgs args(Parser, Param, NumArgs, "json_array_element");
161 nlohmann::json* get = tree(args, 0);
162 const int index = args.num(1);
163 if (!get->is_array() || index < 0 || index >= (int)get->size()) {
164 args.fail("argument 2 is index %d, out of range", index);
165 }
166 ReturnValue->Val->Pointer = &(*get)[index];
167}
168
169void ckpt_json_object_contains(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs)
170{

Callers

nothing calls this directly

Calls 4

treeFunction · 0.85
numMethod · 0.80
failMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected