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.
27 lines
813 B
27 lines
813 B
=proto
|
|
int duk_get_boolean(duk_context *ctx, int index);
|
|
|
|
=stack
|
|
[ ... val! ... ]
|
|
|
|
=summary
|
|
<p>Get the boolean value at <tt>index</tt> without modifying or coercing
|
|
the value. Returns 1 if the value is <tt>true</tt>, 0 if the value is
|
|
<tt>false</tt>, not a boolean, or the index is invalid.</p>
|
|
|
|
<p>Note that the value is not coerced, so a "truthy" Ecmascript value
|
|
(like a non-empty string) will be treated as false. If you want to coerce
|
|
the value, use <tt><a href="#duk_to_boolean">duk_to_boolean()</a></tt>.</p>
|
|
|
|
=example
|
|
if (duk_get_boolean(ctx, -3)) {
|
|
printf("value is true\n");
|
|
}
|
|
|
|
=tags
|
|
stack
|
|
|
|
=fixme
|
|
An API primitive which coerces but doesn't modify value? This would be
|
|
closest to ordinary Ecmascript use. The current behavior comes from the
|
|
idea that duk_get_xxx() calls do not coerce anything.
|
|
|