Flipper Developer Docs
Loading...
Searching...
No Matches
mjs_array_public.h
1
/*
2
* Copyright (c) 2017 Cesanta Software Limited
3
* All rights reserved
4
*/
5
6
/*
7
* === Arrays
8
*/
9
10
#ifndef MJS_ARRAY_PUBLIC_H_
11
#define MJS_ARRAY_PUBLIC_H_
12
13
#include "mjs_core_public.h"
14
15
#if defined(__cplusplus)
16
extern
"C"
{
17
#endif
/* __cplusplus */
18
19
/* Make an empty array object */
20
mjs_val_t mjs_mk_array(
struct
mjs
*
mjs
);
21
22
/* Returns length on an array. If `arr` is not an array, 0 is returned. */
23
unsigned
long
mjs_array_length(
struct
mjs
*
mjs
, mjs_val_t arr);
24
25
/* Insert value `v` in array `arr` at the end of the array. */
26
mjs_err_t mjs_array_push(
struct
mjs
*
mjs
, mjs_val_t arr, mjs_val_t v);
27
28
/*
29
* Return array member at index `index`. If `index` is out of bounds, undefined
30
* is returned.
31
*/
32
mjs_val_t mjs_array_get(
struct
mjs
*, mjs_val_t arr,
unsigned
long
index);
33
34
/* Insert value `v` into `arr` at index `index`. */
35
mjs_err_t mjs_array_set(
struct
mjs
*
mjs
, mjs_val_t arr,
unsigned
long
index, mjs_val_t v);
36
37
/* Returns true if the given value is an array */
38
int
mjs_is_array(mjs_val_t v);
39
40
/* Delete value in array `arr` at index `index`, if it exists. */
41
void
mjs_array_del(
struct
mjs
*
mjs
, mjs_val_t arr,
unsigned
long
index);
42
43
#if defined(__cplusplus)
44
}
45
#endif
/* __cplusplus */
46
47
#endif
/* MJS_ARRAY_PUBLIC_H_ */
mjs
Definition
mjs_core.h:63
lib
mjs
mjs_array_public.h
Generated by
1.12.0