BIS fnc errorParamsType: Difference between revisions
Jump to navigation
Jump to search
(Fixed examples, enhanced parameters) |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | | arma3 | ||
|1.00 | |1.00 | ||
|gr1 = Diagnostic | |gr1 = Diagnostic | ||
|eff= local |Multiplayer Effects= | |eff= local |Multiplayer Effects= | ||
| Displays a parameter type error message (using [[BIS_fnc_error]]) explaining the problem. | | Displays a parameter type error message (using [[BIS_fnc_error]]) explaining the problem. | ||
| [value, method, expected] call [[BIS_fnc_errorParamsType]] | | [value, method, expected] call [[BIS_fnc_errorParamsType]] | ||
|p1= '''value''' (Optional, default: [[nil]]): [[Anything]] - Value received. | |p1= '''value''' (Optional, default: [[nil]]): [[Anything]] - Value received. | ||
|p2= '''method''' (Optional, default: ""): [[String]] - Validation method, can be one of: | |p2= '''method''' (Optional, default: ""): [[String]] - Validation method, can be one of: | ||
Line 20: | Line 20: | ||
* "isEqualTypeAll" | * "isEqualTypeAll" | ||
* "isEqualTypeAny" | * "isEqualTypeAny" | ||
* "isEqualTypeParams" | * "isEqualTypeParams" | ||
|p3= '''expected''' (Optional, default: [[nil]]): [[Anything]] - Expected type. | |p3= '''expected''' (Optional, default: [[nil]]): [[Anything]] - Expected type. | ||
| [[Nothing]] | | [[Nothing]] | ||
|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]] !([[_this]] [[isEqualType]] []) [[exitWith]] { [<nowiki/>[[_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]] !([[_this]] [[isEqualTypeArray]] [0, "", [[true]]]) [[exitWith]] { [<nowiki/>[[_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]] !([[_this]] [[isEqualTypeAll]] [[true]]) [[exitWith]] { [<nowiki/>[[_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>[</nowiki>[], [[objNull]]]) [[exitWith]] { <nowiki>[</nowiki>[[_this]], "isEqualTypeAny", [[], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code> | [[if]] !([[_this]] [[isEqualTypeAny]] <nowiki>[</nowiki>[], [[objNull]]]) [[exitWith]] { <nowiki>[</nowiki>[[_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>[</nowiki>[[_this]], "isEqualTypeParams", [0, [], [[nil]], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code> | [[if]] !([[_this]] [[isEqualTypeParams]] [0, [], [[nil]], [[objNull]]]) [[exitWith]] { <nowiki>[</nowiki>[[_this]], "isEqualTypeParams", [0, [], [[nil]], [[objNull]]]] [[call]] [[BIS_fnc_errorParamsType]]; };</code> | ||
| [[BIS_fnc_error]] | | [[BIS_fnc_error]] | ||
}} | }} |
Revision as of 00:00, 18 January 2021
Description
- Description:
- Displays a parameter type error message (using BIS_fnc_error) explaining the problem.
- Execution:
- call
- Groups:
- Diagnostic
Syntax
- Syntax:
- [value, method, expected] call BIS_fnc_errorParamsType
- 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:
- 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 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