BIS fnc errorParamsType: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ :\\\-\/|()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
m (Text replacement - "_this" to "_this")
Line 27: Line 27:


|x1= <code>{{cc|Show error and abort if input is not of type ARRAY:}}
|x1= <code>{{cc|Show error and abort if input is not of type ARRAY:}}
[[if]] !([[_this]] [[isEqualType]] []) [[exitWith]] { [<nowiki/>[[_this]], "isEqualType", []] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
[[if]] !([[Magic Variables#this|_this]] [[isEqualType]] []) [[exitWith]] { [<nowiki/>[[Magic Variables#this|_this]], "isEqualType", []] [[call]] [[BIS_fnc_errorParamsType]]; };</code>


|x2= <code>{{cc|Show error and abort if array input is not in format [SCALAR, STRING, BOOL]:}}
|x2= <code>{{cc|Show error and abort if array input is not in format [SCALAR, STRING, BOOL]:}}
[[if]] !([[_this]] [[isEqualTypeArray]] [0, "", [[true]]]) [[exitWith]] { [<nowiki/>[[_this]], "isEqualTypeArray", [0, "", [[true]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
[[if]] !([[Magic Variables#this|_this]] [[isEqualTypeArray]] [0, "", [[true]]]) [[exitWith]] { [<nowiki/>[[Magic Variables#this|_this]], "isEqualTypeArray", [0, "", [[true]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>


|x3= <code>{{cc|Show error and abort if array input is not in format [BOOL, BOOL, BOOL, ...]:}}
|x3= <code>{{cc|Show error and abort if array input is not in format [BOOL, BOOL, BOOL, ...]:}}
[[if]] !([[_this]] [[isEqualTypeAll]] [[true]]) [[exitWith]] { [<nowiki/>[[_this]], "isEqualTypeAll", [[true]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
[[if]] !([[Magic Variables#this|_this]] [[isEqualTypeAll]] [[true]]) [[exitWith]] { [<nowiki/>[[Magic Variables#this|_this]], "isEqualTypeAll", [[true]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
|x4= <code>{{cc|Show error and abort if input is neither ARRAY nor OBJECT:}}
|x4= <code>{{cc|Show error and abort if input is neither ARRAY nor OBJECT:}}
[[if]] !([[_this]] [[isEqualTypeAny]] [<nowiki/>[], [[objNull]]]) [[exitWith]] { [<nowiki/>[[_this]], "isEqualTypeAny", [[], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
[[if]] !([[Magic Variables#this|_this]] [[isEqualTypeAny]] [<nowiki/>[], [[objNull]]]) [[exitWith]] { [<nowiki/>[[Magic Variables#this|_this]], "isEqualTypeAny", [[], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>


|x5= <code>{{cc|Show error and abort if input is neither of type ARRAY nor array in format [SCALAR, ARRAY, <ANYTHING>, OBJECT]:}}
|x5= <code>{{cc|Show error and abort if input is neither of type ARRAY nor array in format [SCALAR, ARRAY, <ANYTHING>, OBJECT]:}}
[[if]] !([[_this]] [[isEqualTypeParams]] [0, [], [[nil]], [[objNull]]]) [[exitWith]] { [<nowiki/>[[_this]], "isEqualTypeParams", [0, [], [[nil]], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>
[[if]] !([[Magic Variables#this|_this]] [[isEqualTypeParams]] [0, [], [[nil]], [[objNull]]]) [[exitWith]] { [<nowiki/>[[Magic Variables#this|_this]], "isEqualTypeParams", [0, [], [[nil]], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code>


|seealso= [[BIS_fnc_error]]
|seealso= [[BIS_fnc_error]]
}}
}}

Revision as of 14:19, 25 February 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Diagnostic

Syntax

Syntax:
Syntax needed
Parameters:
value (Optional, default: nil): Anything - Value received.
method (Optional, default: ""): String - Validation method, can be one of:
  • "isEqualType"
  • "isEqualTypeArray"
  • "isEqualTypeAll"
  • "isEqualTypeAny"
  • "isEqualTypeParams"
expected (Optional, default: nil): Anything - Expected type.
Return Value:
Return value needed

Examples

Example 1:
// Show error and abort if input is not of type ARRAY: if !(_this isEqualType []) exitWith { [_this, "isEqualType", []] call BIS_fnc_errorParamsType; };
Example 2:
// Show error and abort if array input is not in format [SCALAR, STRING, BOOL]: if !(_this isEqualTypeArray [0, "", true]) exitWith { [_this, "isEqualTypeArray", [0, "", true]] call BIS_fnc_errorParamsType; };
Example 3:
// Show error and abort if array input is not in format [BOOL, BOOL, BOOL, ...]: if !(_this isEqualTypeAll true) exitWith { [_this, "isEqualTypeAll", true] call BIS_fnc_errorParamsType; };
Example 4:
// Show error and abort if input is neither ARRAY nor OBJECT: if !(_this isEqualTypeAny [[], objNull]) exitWith { [_this, "isEqualTypeAny", [[], objNull]] call BIS_fnc_errorParamsType; };
Example 5:
// Show error and abort if input is neither of type ARRAY nor array in format [SCALAR, ARRAY, <ANYTHING>, OBJECT]: if !(_this isEqualTypeParams [0, [], nil, objNull]) exitWith { [_this, "isEqualTypeParams", [0, [], nil, objNull]] call BIS_fnc_errorParamsType; };

Additional Information

See also:
BIS_fnc_error

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