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.

28 lines
915 B

name: duk_to_uint
11 years ago
proto: |
duk_uint_t duk_to_uint(duk_context *ctx, duk_idx_t index);
11 years ago
stack: |
[ ... val! ... ] -> [ ... ToNumber(val)! ... ]
11 years ago
summary: |
<p>Like <code><a href="#duk_to_int">duk_to_int()</a></code> but the return value
coercion is the same as in <code><a href="#duk_get_uint">duk_get_uint()</a></code>.</p>
<div class="note">
<code>duk_get_uint()</code> int coercion is applied only to the return value, it is not
reflected on the value stack. For instance, if value stack contains the string
<code>"Infinity"</code>, the value on the stack will be coerced to the number
<code>Infinity</code> and <code>DUK_UINT_MAX</code> will be returned from the API call.
</div>
11 years ago
example: |
printf("ToInteger() + uint coercion: %lu\n", (unsigned long) duk_to_uint(ctx, -3));
printf("ToInteger() coercion: %lf\n", (double) duk_get_number(ctx, -3));
tags:
- stack
introduced: 1.0.0