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.
26 lines
465 B
26 lines
465 B
11 years ago
|
=proto
|
||
11 years ago
|
duk_idx_t duk_get_top_index(duk_context *ctx);
|
||
11 years ago
|
|
||
|
=summary
|
||
|
<p>Get the absolute index (>= 0) of the topmost value on the stack.
|
||
11 years ago
|
If the stack is empty, returns <code>DUK_INVALID_INDEX</code>.</p>
|
||
11 years ago
|
|
||
|
=example
|
||
11 years ago
|
duk_idx_t idx_top;
|
||
11 years ago
|
|
||
|
idx_top = duk_get_top_index(ctx);
|
||
|
if (idx_top == DUK_INVALID_INDEX) {
|
||
|
printf("stack is empty\n");
|
||
|
} else {
|
||
11 years ago
|
printf("index of top element: %ld\n", (long) idx_top);
|
||
11 years ago
|
}
|
||
|
|
||
|
=tags
|
||
|
stack
|
||
|
|
||
|
=seealso
|
||
|
duk_require_top_index
|
||
10 years ago
|
|
||
|
=introduced
|
||
|
1.0.0
|