=proto double duk_to_number(duk_context *ctx, int index); =stack [ ... val! ... ] -> [ ... ToNumber(val)! ... ] =summary

Replace the value at index with an Ecmascript ToNumber() coerced value. Returns the coerced value. If index is invalid, throws an error.

Custom type coercion:

=example printf("coerced number: %lf\n", duk_to_number(ctx, -3)); =tags stack =fixme Are the current custom coercions sensible? For instance, should pointer coerce to its numeric value?