name: duk_to_uint proto: | duk_uint_t duk_to_uint(duk_context *ctx, duk_idx_t idx); stack: | [ ... val! ... ] -> [ ... ToNumber(val)! ... ] summary: |

Like duk_to_int() but the return value coercion is the same as in duk_get_uint().

duk_get_uint() 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 "Infinity", the value on the stack will be coerced to the number Infinity and DUK_UINT_MAX will be returned from the API call.
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