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.
22 lines
407 B
22 lines
407 B
11 years ago
|
/*===
|
||
|
0: 123
|
||
|
1: foo
|
||
|
2: 345
|
||
|
===*/
|
||
|
|
||
|
void test(duk_context *ctx) {
|
||
|
int i, n;
|
||
|
|
||
|
duk_push_int(ctx, 123);
|
||
|
duk_push_int(ctx, 234);
|
||
|
duk_push_int(ctx, 345); /* -> [ 123 234 345 ] */
|
||
|
duk_push_string(ctx, "foo"); /* -> [ 123 234 345 "foo" ] */
|
||
|
duk_replace(ctx, -3); /* -> [ 123 "foo" 345 ] */
|
||
|
|
||
|
n = duk_get_top(ctx);
|
||
|
for (i = 0; i < n; i++) {
|
||
|
printf("%d: %s\n", i, duk_to_string(ctx, i));
|
||
|
}
|
||
|
}
|
||
|
|