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.
33 lines
1.1 KiB
33 lines
1.1 KiB
=proto
|
|
int duk_equals(duk_context *ctx, int index1, int index2);
|
|
|
|
=stack
|
|
[ ... val1! ... val2! ... ]
|
|
|
|
=summary
|
|
<p>Compare values at <code>index1</code> and <code>index2</code> for equality.
|
|
Returns 1 if values are considered equal using Ecmascript
|
|
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.1">Equals</a>
|
|
operator (<code>==</code>) semantics, otherwise returns 0. Also returns 0 if either
|
|
index is invalid.</p>
|
|
|
|
<p>Because
|
|
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3">The Abstract Equality Comparison Algorithm</a>
|
|
used by the Equals operator performs value coercion (<code>ToNumber()</code> and <code>ToPrimitive()</code>),
|
|
the comparison may have side effects and may throw an error. The strict equality comparison,
|
|
available through <code><a href="#duk_strict_equals">duk_strict_equals()</a></code>, has no
|
|
side effects.</p>
|
|
|
|
=example
|
|
if (duk_equals(ctx, -3, -7)) {
|
|
printf("values at indices -3 and -7 are equal\n");
|
|
}
|
|
|
|
=tags
|
|
compare
|
|
|
|
=seealso
|
|
duk_strict_equals
|
|
|
|
=fixme
|
|
Currently buffer equality does not cause buffer contents to be compared.
|
|
|