name: duk_to_boolean proto: | duk_bool_t duk_to_boolean(duk_context *ctx, duk_idx_t 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.

example: | if (duk_to_boolean(ctx, -3)) { printf("coerced value is true\n"); } tags: - stack introduced: 1.0.0