=proto
unsigned int duk_to_uint32(duk_context *ctx, int index);
=stack
[ ... val! ... ] -> [ ... ToUint32(val)! ... ]
=summary
Replace the value at index with an Ecmascript
ToUint32()
coerced value. Returns the coerced value. If index is invalid, throws
an error.
Custom type coercion:
- Buffer: 0 for zero-size buffer, 1 otherwise
- Pointer: 0 for NULL pointer, 1 otherwise
The result of ToUint32() is an unsigned 32-bit integer and is assumed to
fit into the C unsigned int type. If the C type is smaller, the value will be
coerced by the C compiler (double to unsigned int).
=example
printf("ToUint32(): %u\n", duk_to_uint32(ctx, -3));
=tags
stack
=fixme
Apply the duk_get_int() coercion to the result just in case? It would clamp
output values to INT_MIN and INT_MAX. This is not very relevant because if
int is smaller than 32 bits, everything will break anyway.