BIS fnc parseNumberSafe: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (added examples)
m (Some wiki formatting)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.96


|1.95|Game version=
|gr1= Arrays


<!---|arg= local |Multiplayer Arguments=--->
|descr= Converts expression into a number. Can also convert array of expressions into an array of numbers. If expression does not return a number, 0 is returned.


<!---|eff= local |Multiplayer Effects=--->
|s1= [input] call [[BIS_fnc_parseNumberSafe]]


| <pre>/*
|p1= input: [[Number]], [[String]], [[Side]], [[Config]] or [[Array]] - if type is array, array may contain any of the mentioned data types
Author:  
Killzone_Kid


Description:
|r1= [[Number]] or [[Array]] of [[Number]]s if ''input'' is an [[Array]]
Converts expression into a number (or array of expressions into an array of numbers)
If expression does not return a number, 0 is returned


Parameter(s):
|x1= <sqf>[safeZoneX, safeZoneWAbs, configFile] call BIS_fnc_parseNumberSafe; // returns [-0.452381,1.90476,0]</sqf>
NUMBER, STRING, ARRAY, SIDE, CONFIG (NUMBER, STRING, ARRAY)
Returns:
NUMBER (or ARRAY of NUMBERs if ARRAY is passed as an argument)
*/</pre>{{Informative|Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]]}} |Description=


|[] call [[BIS_fnc_parseNumberSafe]]|Syntax=
|x2= <sqf>["1337", "2013", date] call BIS_fnc_parseNumberSafe; // returns [1337,2013,[2036,1,1,6,58]]</sqf>


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|x3= <sqf>[blufor, opfor, independent, civilian] call BIS_fnc_parseNumberSafe; // returns [1,0,2,3]</sqf>


|Datatype - description|Return value=
|seealso= [[parseNumber]] [[BIS_fnc_parseNumber]]
 
|x1= <code><nowiki>[</nowiki>[[safeZoneX]],[[safeZoneWAbs]],[[configFile]]<nowiki>]</nowiki> [[call]] [[BIS_fnc_parseNumberSafe]];{{cc|Returns [-0.452381,1.90476,0]}}</code>|Example 1=
|x2= <code>["1337","2013",[[date]]] [[call]] [[BIS_fnc_parseNumberSafe]];{{cc|Returns [1337,2013,[2036,1,1,6,58]]}}</code>|Example 2=
|exec= call |Execution=
 
|[[BIS_fnc_parseNumber]] [[parseNumber]] |See also=
}}
}}
[[Category:Function Group: Numbers|{{uc:parseNumberSafe}}]]
[[Category:Functions|{{uc:parseNumberSafe}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:parseNumberSafe}}]]

Latest revision as of 14:50, 8 November 2023

Hover & click on the images for description

Description

Description:
Converts expression into a number. Can also convert array of expressions into an array of numbers. If expression does not return a number, 0 is returned.
Execution:
call
Groups:
Arrays

Syntax

Syntax:
[input] call BIS_fnc_parseNumberSafe
Parameters:
input: Number, String, Side, Config or Array - if type is array, array may contain any of the mentioned data types
Return Value:
Number or Array of Numbers if input is an Array

Examples

Example 1:
[safeZoneX, safeZoneWAbs, configFile] call BIS_fnc_parseNumberSafe; // returns [-0.452381,1.90476,0]
Example 2:
["1337", "2013", date] call BIS_fnc_parseNumberSafe; // returns [1337,2013,[2036,1,1,6,58]]
Example 3:
[blufor, opfor, independent, civilian] call BIS_fnc_parseNumberSafe; // returns [1,0,2,3]

Additional Information

See also:
parseNumber BIS_fnc_parseNumber

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