mirror of https://github.com/svaarala/duktape.git
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.
28 lines
567 B
28 lines
567 B
=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
|
|
|