BIS fnc errorParamsType: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>([^<]*)\[\[[^|]+\| *([a-zA-Z= _]+) *\]\]([^<]*)<\/code>" to "<code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 12: | Line 12: | ||
|s1= [value, method, expected] call [[BIS_fnc_errorParamsType]] | |s1= [value, method, expected] call [[BIS_fnc_errorParamsType]] | ||
|p1= '''value''' (Optional, default | |p1= '''value''': [[Anything]] - (Optional, default [[nil]]) value received. | ||
|p2= '''method''' (Optional, default | |p2= '''method''': [[String]] - (Optional, default "") validation method, can be one of: | ||
* "isEqualType" | * "isEqualType" | ||
* "isEqualTypeArray" | * "isEqualTypeArray" | ||
Line 25: | Line 25: | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf> | ||
_this _this, "isEqualType", []] | // show error and abort if input is not of type ARRAY: | ||
if !(_this isEqualType []) exitWith { [_this, "isEqualType", []] call BIS_fnc_errorParamsType; }; | |||
</sqf> | |||
|x2= < | |x2= <sqf> | ||
_this _this, "isEqualTypeArray", [0, "", | // 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; }; | |||
</sqf> | |||
|x3= < | |x3= <sqf> | ||
_this _this, "isEqualTypeAll", | // 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; }; | |||
</sqf> | |||
|x4= < | |x4= <sqf> | ||
_this _this, "isEqualTypeAny", [[], | // show error and abort if input is neither ARRAY nor OBJECT: | ||
if !(_this isEqualTypeAny [[], objNull]) exitWith { [_this, "isEqualTypeAny", [[], objNull]] call BIS_fnc_errorParamsType; }; | |||
</sqf> | |||
|x5= < | |x5= <sqf> | ||
// 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; }; | |||
</sqf> | |||
|seealso= [[BIS_fnc_error]] | |seealso= [[BIS_fnc_error]] | ||
}} | }} |
Revision as of 17:16, 13 July 2022
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: Anything - (Optional, default nil) value received.
- method: String - (Optional, default "") validation method, can be one of:
- "isEqualType"
- "isEqualTypeArray"
- "isEqualTypeAll"
- "isEqualTypeAny"
- "isEqualTypeParams"
- expected (Optional, default: nil): Anything - Expected type.
- Return Value:
- Nothing
Examples
- Example 1:
- Example 2:
- Example 3:
- Example 4:
- Example 5:
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