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.
 
 
 
 
 
 

24 lines
504 B

name: duk_dup
proto: |
void duk_dup(duk_context *ctx, duk_idx_t from_idx);
stack: |
[ ... val! ... ] -> [ ... val! ... val! ]
summary: |
<p>Push a duplicate of value at <code>from_idx</code> to the stack.
If <code>from_idx</code> 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 ] */
tags:
- stack
seealso:
- duk_dup_top
introduced: 1.0.0