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.
23 lines
457 B
23 lines
457 B
name: duk_swap
|
|
|
|
proto: |
|
|
void duk_swap(duk_context *ctx, duk_idx_t index1, duk_idx_t index2);
|
|
|
|
stack: |
|
|
[ ... val1! ... val2! ... ] -> [ ... val2! ... val1! ... ]
|
|
|
|
summary: |
|
|
<p>Swap values at indices <code>index1</code> and <code>index2</code>. If the
|
|
indices are the same, the call is a no-op. If either index is invalid,
|
|
throws an error.</p>
|
|
|
|
example: |
|
|
duk_swap(ctx, -5, -1);
|
|
|
|
tags:
|
|
- stack
|
|
|
|
seealso:
|
|
- duk_swap_top
|
|
|
|
introduced: 1.0.0
|
|
|