isEqualTypeParams: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)<\/code>" to "<code>$1$2$3 $4 $5 $6</code>")
mNo edit summary
 
(9 intermediate revisions by one other user not shown)
Line 15: Line 15:
|p1= input: [[Anything]] - could be value of any type, but only type [[Array]] will be validated
|p1= input: [[Anything]] - could be value of any type, but only type [[Array]] will be validated


|p2= template: [[Array]] - array of expected types
|p2= template: [[Array]] of [[Anything]] - array of expected types


|r1= [[Boolean]]
|r1= [[Boolean]]


|x1= <code>// These all return true
|x1= <sqf>
[1,2,[[player]],"10"] [[isEqualTypeParams]] [0,0,[[objNull]],""];
// These all return true
[1,2,[[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""];
[1,2,player,"10"] isEqualTypeParams [0,0,objNull,""];
[1,2,getPos player,"10",true] isEqualTypeParams [0,0,nil,""];</code>
[1,2,player,"10",true] isEqualTypeParams [0,0,nil,""];
[1,2,getPos player,"10",true] isEqualTypeParams [0,0,nil,""];
</sqf>


|x2= <code>// These all return false
|x2= <sqf>
123 [[isEqualTypeParams]] [0,0,[[objNull]],""];
// These all return false
[] [[isEqualTypeParams]] [0,0,[[objNull]],""];
123 isEqualTypeParams [0,0,objNull,""];
[1,2,player] isEqualTypeParams [0,0,objNull,""];</code>
[] isEqualTypeParams [0,0,objNull,""];
[1,2,player] isEqualTypeParams [0,0,objNull,""];
</sqf>


|seealso= [[isEqualTypeAll]] [[isEqualTypeAny]] [[isEqualType]] [[isEqualTypeArray]] [[param]] [[params]] [[isEqualTo]] [[typeName]]
|seealso= [[isEqualTypeAll]] [[isEqualTypeAny]] [[isEqualType]] [[isEqualTypeArray]] [[param]] [[params]] [[isEqualTo]] [[typeName]]
}}
}}

Latest revision as of 10:48, 1 January 2026

Hover & click on the images for description

Description

Description:
Compares types of all elements of input array to types of all elements of template array. Similar to isEqualTypeArray however this command is designed for fast validation of functions params, so there are differences:
  • Input can be anything but will be expected to be an Array, otherwise false is returned
  • Input array can be longer but not shorter than template array, will return false if shorter
  • nil could be used in template type array as a wild card to allow any type match
Groups:
Variables

Syntax

Syntax:
input isEqualTypeParams template
Parameters:
input: Anything - could be value of any type, but only type Array will be validated
template: Array of Anything - array of expected types
Return Value:
Boolean

Examples

Example 1:
// These all return true [1,2,player,"10"] isEqualTypeParams [0,0,objNull,""]; [1,2,player,"10",true] isEqualTypeParams [0,0,nil,""]; [1,2,getPos player,"10",true] isEqualTypeParams [0,0,nil,""];
Example 2:
// These all return false 123 isEqualTypeParams [0,0,objNull,""]; [] isEqualTypeParams [0,0,objNull,""]; [1,2,player] isEqualTypeParams [0,0,objNull,""];

Additional Information

See also:
isEqualTypeAll isEqualTypeAny isEqualType isEqualTypeArray param params isEqualTo typeName

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note