mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
633 B
25 lines
633 B
name: duk_to_boolean
|
|
|
|
proto: |
|
|
duk_bool_t duk_to_boolean(duk_context *ctx, duk_idx_t idx);
|
|
|
|
stack: |
|
|
[ ... val! ... ] -> [ ... ToBoolean(val)! ... ]
|
|
|
|
summary: |
|
|
<p>Replace the value at <code>idx</code> with an Ecmascript
|
|
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-9.2">ToBoolean()</a>
|
|
coerced value. Returns 1 if the result of the coercion <code>true</code>, 0 otherwise.
|
|
If <code>idx</code> is invalid, throws an error.</p>
|
|
|
|
<div include="ref-custom-type-coercion.html" />
|
|
|
|
example: |
|
|
if (duk_to_boolean(ctx, -3)) {
|
|
printf("coerced value is true\n");
|
|
}
|
|
|
|
tags:
|
|
- stack
|
|
|
|
introduced: 1.0.0
|
|
|