name: duk_dup_top proto: | void duk_dup_top(duk_context *ctx); stack: | [ ... val! ] -> [ ... val! val! ] summary: |

Push a duplicate of the value at stack top to the stack. If the value stack is empty, throws an error.

Equivalent to calling duk_dup(ctx, -1).

example: | duk_push_int(ctx, 123); /* -> [ ... 123 ] */ duk_push_int(ctx, 234); /* -> [ ... 123 234 ] */ duk_dup_top(ctx); /* -> [ ... 123 234 234 ] */ tags: - stack introduced: 1.0.0