Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.24

Description

Description:Searches a mixed array for a matching flag, and returns the argument that follows it.

Syntax

Syntax:[array,flag,default] call fn_vbs_GetArg
Parameters:
  • array: Array - Mixed array to search.
  • flag: String - Flag that is being searched for (case-insensitive). The flag in the tested array needs to end with a colon, in order to be recognized.
  • default: Anything - Value to return, if the flag is not found.
Return Value:Anything - Array element that follows the flag (or default value, if not found).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
Script call:
_nul = [player,1,"RIGHT:",20,"LEFT:",10] execVM "tst.sqf"; 
Inside "tst.sqf":
#include "\vbs2\headers\function_library.hpp"
_left=[_this,"left",100] call fn_vbs_GetArg; // Returns 10
_right=[_this,"right",200] call fn_vbs_GetArg; // Returns 20
_mid=[_this,"mid",(_left+_right)/2] call fn_vbs_GetArg; // Uses default: 15

Additional Information

See also: 
Multiplayer: 
Problems: 

Notes