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.
27 lines
913 B
27 lines
913 B
name: duk_to_uint
|
|
|
|
proto: |
|
|
duk_uint_t duk_to_uint(duk_context *ctx, duk_idx_t idx);
|
|
|
|
stack: |
|
|
[ ... val! ... ] -> [ ... ToNumber(val)! ... ]
|
|
|
|
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>
|
|
|
|
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
|
|
|