diff --git a/docs/equals.md b/docs/equals.md new file mode 100644 index 0000000..1317c6c --- /dev/null +++ b/docs/equals.md @@ -0,0 +1,35 @@ +# equals + +Returns true if the two values are equal, false otherwise. + +## Parameters + +* a (`integer`, `float`, `double`, `string`, `boolean`, `instruction`) - The first value to compare. +* b (`integer`, `float`, `double`, `string`, `boolean`, `instruction`) - The second value to compare. + +## Return + +(`boolean`) - True if the two values are equal, false otherwise. + +## Exceptions + +* `EvaluationException` - If there was an error while evaluating one or more parameters. +* `TypeException` - If one or more parameters are not of the expected type. + + +## Instruction Example + +```json +{ + "type": "equals", + "_": { + "a": "foo", + "b": "foo" + } +} +``` + +### Last Updated + +Monday, December 29th, 2022. +Written by [Netkas](https://git.n64.cc/netkas) \ No newline at end of file diff --git a/src/RTEX/Objects/Program/Instructions/Equals.php b/src/RTEX/Objects/Program/Instructions/Equals.php index 7ef78a8..97a2ac5 100644 --- a/src/RTEX/Objects/Program/Instructions/Equals.php +++ b/src/RTEX/Objects/Program/Instructions/Equals.php @@ -66,14 +66,13 @@ * @param Engine $engine * @return bool * @throws EvaluationException - * @throws EvaluationException */ public function eval(Engine $engine): bool { $a = $engine->eval($this->A); $b = $engine->eval($this->B); - return $a === $b; + return ($a === $b); } /**