| 156 | } |
| 157 | |
| 158 | void 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 | |
| 169 | void ckpt_json_object_contains(struct ParseState* Parser, struct Value* ReturnValue, struct Value** Param, int NumArgs) |
| 170 | { |