You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
652 B

name: duk_push_array
proto: |
duk_idx_t duk_push_array(duk_context *ctx);
stack: |
[ ... ] -> [ ... arr! ]
summary: |
<p>Push an empty array to the stack. Returns non-negative index (relative to stack bottom)
of the pushed array.</p>
example: |
duk_idx_t arr_idx;
arr_idx = duk_push_array(ctx);
duk_push_string(ctx, "foo");
duk_put_prop_index(ctx, arr_idx, 0);
duk_push_string(ctx, "bar");
duk_put_prop_index(ctx, arr_idx, 1);
/* array is now: [ "foo", "bar" ], and array.length is 2 (automatically
* updated for Ecmascript arrays).
*/
duk_pop(ctx); /* pop array */
tags:
- stack
- object
introduced: 1.0.0