isEqualTypeParams: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (template:command argument fix)
Line 12: Line 12:
* 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
|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| input '''isEqualTypeParams''' template |= Syntax
| input '''isEqualTypeParams''' template |SYNTAX=


|p1= input: [[Anything]] - could be value of any type, but only type [[Array]] will be validated |= Parameter 1
|p1= input: [[Anything]] - could be value of any type, but only type [[Array]] will be validated |PARAMETER1=
|p2= template: [[Array]] - array of expected types |= Parameter 2
|p2= template: [[Array]] - array of expected types |PARAMETER2=


| [[Boolean]] |= Return value
| [[Boolean]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
Line 28: Line 28:
[1,2,[[player]]] [[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,[[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""]; //true
[1,2,[[getPos]] [[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""]; //true</code> |= Example 1
[1,2,[[getPos]] [[player]],"10",[[true]]] [[isEqualTypeParams]] [0,0,[[nil]],""]; //true</code> |EXAMPLE1=


____________________________________________________________________________________________
____________________________________________________________________________________________


|[[isEqualTypeAll]], [[isEqualTypeAny]], [[isEqualType]], [[isEqualTypeArray]], [[param]], [[params]], [[isEqualTo]], [[typeName]]|= See also
|[[isEqualTypeAll]], [[isEqualTypeAny]], [[isEqualType]], [[isEqualTypeArray]], [[param]], [[params]], [[isEqualTo]], [[typeName]]|SEEALSO=


}}
}}

Revision as of 15:41, 7 April 2019

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:
Uncategorised

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:
[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

Additional Information

See also:
isEqualTypeAllisEqualTypeAnyisEqualTypeisEqualTypeArrayparamparamsisEqualTotypeName

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

Notes

Bottom Section