Page MenuHomeFeedback Tracker

Add new command "isEqualTo" for binary comparison
Closed, ResolvedPublic

Description

Syntax:
a isEqualTo b

where:
a - Anything
b - Anything

Return: Boolean true/false

Example:
_arr1 = [1,2,3];
_arr2 = [1,2,3];
if (_arr1 isEqualTo _arr2) then {hint "arrays match!"};

For more information see http://killzonekid.com/arma-scripting-tutorials-kk_fnc_isequal-compare-booleans-and-arrays/

It could even be a copy paste job since (see below) you can have scripted solution for it already, however dedicated command is most welcome.

Details

Legacy ID
4151082295
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Feature Request
Steps To Reproduce

KK_fnc_isEqual = {

switch (_this select 0) do {
    case (_this select 1) : {true};
    default {false};
};

};

hint str (["hello", "Hello"] call KK_fnc_isEqual); false
hint str (["ABC", "ABC"] call KK_fnc_isEqual);
true
hint str ([1, "ABC"] call KK_fnc_isEqual); false (no error)
hint str ([16, 16] call KK_fnc_isEqual);
true
hint str ([player, vehicle player] call KK_fnc_isEqual); true
hint str ([false, false] call KK_fnc_isEqual);
true
hint str ([true, false] call KK_fnc_isEqual); false
hint str ([true, 1 == 1] call KK_fnc_isEqual);
true
hint str ([[1,2,3], [1,2,3]] call KK_fnc_isEqual); true
hint str (1,[2,[3], [1,[2,[3]]]] call KK_fnc_isEqual);
true
hint str (1,[2,[3], [1,[2,[4]]]] call KK_fnc_isEqual); //false

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Feature Request.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Fixed.
Killzone_Kid set Legacy ID to 4151082295.May 7 2016, 6:16 PM

check new DEVbranch build ;)

Seven votes are enough to get an issue assigned and fixed? Wow!

WOW! Thank you very much japapatramtara!

@shredthesky The method was already available in the engine (switch command), this is why it was an easy implementation. Also array comparison in Arma was needed for a long time.

This is making me happier than I want to admit.

so I guess that everything goes fine now..

Thank you japa. Legend!

Thanks KK and Japa - this will be very useful :)

MadDogX added a subscriber: MadDogX.May 7 2016, 6:16 PM

Mass closing tickets marked as resolved more than 1 month ago.

If the issue is in fact not resolved, please create a new ticket referencing this one and ask for it to be re-opened.