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.
15 lines
397 B
15 lines
397 B
11 years ago
|
=proto
|
||
|
void duk_dup(duk_context *ctx, int from_index);
|
||
|
|
||
|
=stack
|
||
|
[ ... val! ... ] -> [ ... val! ... val! ]
|
||
|
|
||
|
=summary
|
||
|
<p>Push a duplicate of value at <tt>from_index</tt> to the stack.
|
||
|
If <tt>from_index</tt> is invalid, throws an error.</p>
|
||
|
|
||
|
=example
|
||
|
duk_push_int(ctx, 123); /* -> [ ... 123 ] */
|
||
|
duk_push_int(ctx, 234); /* -> [ ... 123 234 ] */
|
||
|
duk_dup(ctx, -2); /* -> [ ... 123 234 123 ] */
|