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.
 
 
 
 
 
 

25 lines
465 B

=proto
duk_idx_t duk_get_top_index(duk_context *ctx);
=summary
<p>Get the absolute index (>= 0) of the topmost value on the stack.
If the stack is empty, returns <code>DUK_INVALID_INDEX</code>.</p>
=example
duk_idx_t idx_top;
idx_top = duk_get_top_index(ctx);
if (idx_top == DUK_INVALID_INDEX) {
printf("stack is empty\n");
} else {
printf("index of top element: %ld\n", (long) idx_top);
}
=tags
stack
=seealso
duk_require_top_index
=introduced
1.0.0