isEqualTypeParams: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[[Cc]ategory:[ _]?Arma[ _]3:[ _]([^|]*)[ _]?\|.*\]\]" to "{{GameCategory|arma3|$1}}")
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(39 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 1.54


|1.54|= Game version
|gr1= Variables


|gr1= Variables |GROUP1=
|descr= 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:
 
____________________________________________________________________________________________
 
| 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 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
* 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
* [[nil]] could be used in template type array as a wild card to allow any type match
|DESCRIPTION=
____________________________________________________________________________________________


| input '''isEqualTypeParams''' template |SYNTAX=
|s1= input [[isEqualTypeParams]]  template
 
|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 |PARAMETER1=
|p2= template: [[Array]] - array of expected types
|p2= template: [[Array]] - array of expected types |PARAMETER2=


| [[Boolean]] |RETURNVALUE=
|r1= [[Boolean]]
____________________________________________________________________________________________
 
|x1= <code>[1,2,[[player]],"10"] [[isEqualTypeParams]] [0,0,[[objNull]],""]; //true
123 [[isEqualTypeParams]] [0,0,[[objNull]],""]; //false
[] [[isEqualTypeParams]] [0,0,[[objNull]],""]; //false
[1,2,[[player]]] [[isEqualTypeParams]] [0,0,[[objNull]],""]; //false
[1,2,[[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""]; //true
[1,2,[[getPos]] [[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""]; //true</code> |EXAMPLE1=


____________________________________________________________________________________________
|x1= <sqf>
// 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,""];
</sqf>


|[[isEqualTypeAll]], [[isEqualTypeAny]], [[isEqualType]], [[isEqualTypeArray]], [[param]], [[params]], [[isEqualTo]], [[typeName]]|SEEALSO=
|x2= <sqf>
// These all return false
123 isEqualTypeParams [0,0,objNull,""];
[] isEqualTypeParams [0,0,objNull,""];
[1,2,player] isEqualTypeParams [0,0,objNull,""];
</sqf>


|seealso= [[isEqualTypeAll]] [[isEqualTypeAny]] [[isEqualType]] [[isEqualTypeArray]] [[param]] [[params]] [[isEqualTo]] [[typeName]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|New_Scripting_Commands_List}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]

Latest revision as of 19:42, 3 September 2024

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 - 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 or on the Forums.
Only post proven facts here! Add Note