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

Replace the value at index with an Ecmascript ToBoolean() coerced value. Returns 1 if the result of the coercion true, 0 otherwise. If index is invalid, throws an error.

Custom type coercion:

=example if (duk_to_boolean(ctx, -3)) { printf("coerced value is true\n"); } =tags stack =fixme Describe coercion rules for custom types in a central location and just link there?