BIS fnc errorParamsType: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
(Page filling)
Line 5: Line 5:
|1.00|Game version=
|1.00|Game version=


<!---|arg= local |Multiplayer Arguments=--->
|eff= local |Multiplayer Effects=


<!---|eff= local |Multiplayer Effects=--->
| Displays a parameter type error message (using [[BIS_fnc_error]]) explaining the problem. |Description=


| <pre>/*
| [value, method, expected] call [[BIS_fnc_errorParamsType]] |Syntax=
Author: Killzone_Kid


Description:
|p1= value: [[Anything]] - (Optional, default [[nil]]) value received |Parameter 1=
Displays params type error message explaining the problem


Parameter(s):
|p2= method: [[String]] - (Optional, default "") validation method, can be one of:
0: ANY - actual input
* "isEqualType"
1: STRING - validation method - the name of type validation command used:
* "isEqualTypeArray"
* "isEqualType"
* "isEqualTypeAll"
* "isEqualTypeArray"
* "isEqualTypeAny"
* "isEqualTypeAll"
* "isEqualTypeParams" |Parameter 2=
* "isEqualTypeAny"
* "isEqualTypeParams"
2: ANY - expected input type format


Returns:
|p3= expected: [[Anything]] - (Optional, default [[nil]]) - expected type |Parameter 3=
NOTHING
 
| [[Nothing]] |Return value=
Example1:
//Show error and abort if input is not of type ARRAY
if !(_this isEqualType []) exitWith {[_this,"isEqualType",[]] call BIS_fnc_errorParamsType};
Example2:
//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};
Example3:
//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};
Example4:
//Show error and abort if input is neither ARRAY nor OBJECT
if !(_this isEqualTypeAny [[],objNull]) exitWith {[_this,"isEqualTypeAny",[[],objNull]] call BIS_fnc_errorParamsType};
Example5:
//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};
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_errorParamsType]]|Syntax=
|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> |Example 1=


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|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> |Example 2=


|Datatype - description|Return value=
|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> |Example 3=
|x4= <code>{{cc|Show error and abort if input is neither ARRAY nor OBJECT}}
[[if]] !([[_this]] [[isEqualTypeAny]] [[], [[objNull]]]) [[exitWith]] { [<nowiki/>[[_this]], "isEqualTypeAny", [[], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]] };</code> |Example 4=


|x1= <code></code>|Example 1=
|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> |Example 5=


| |See also=
| [[BIS_fnc_error]] |See also=
}}
}}


[[Category:Function Group: Debug|{{uc:errorParamsType}}]]
[[Category:Function Group: Debug|{{uc:errorParamsType}}]]
[[Category:Functions|{{uc:errorParamsType}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:errorParamsType}}]]

Revision as of 12:56, 26 June 2020

Hover & click on the images for description

Description

Description:
Displays a parameter type error message (using BIS_fnc_error) explaining the problem.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[value, method, expected] call BIS_fnc_errorParamsType
Parameters:
value: Anything - (Optional, default nil) value received
method: String - (Optional, default "") validation method, can be one of:
  • "isEqualType"
  • "isEqualTypeArray"
  • "isEqualTypeAll"
  • "isEqualTypeAny"
  • "isEqualTypeParams"
expected: Anything - (Optional, default nil) - expected type
Return Value:
Nothing

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 4= |x5= // 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