argument params [element1, element2,...elementN]

Operand types

argument: Anything
[element1, element2,...elementN]: Array

Type of returned value

Description

Parses input argument into array of private variables, similar to BIS_fnc_param. When used without argument, as shown in main syntax, internal variable _this, which is usually available inside functions and event handlers, is used as argument.

In addition to simple parsing directly into variables, input can be tested in case it is undefined, of the wrong type or of the wrong size (if array) and substituted if necessary with default values. Substitutes can also be logged into .rpt file, if allowFunctionsLog param in description.ext is set to 1.

argument: Anything

elementN: String or Array
If String then it is the name of a private variable (must begin with underscore _, e.g. "_myVar")
If Array then it should be one of the following constructs:

  • [variableName, defaultValue]

  • [variableName, defaultValue, expectedDataTypes]

  • [variableName, defaultValue, expectedDataTypes, expectedArrayCount]


variableName: String - name of a private variable (must begin with underscore _, e.g. "_myVar")
defaultValue: Anything - default value to return if input element is undefined, of the wrong type or of the wrong size (if array).
expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.
expectedArrayCount (Optional): Number or Array - a single size or array of sizes. If passed input value is an array, checks that it has a certain number of elements. If not, default value is used instead. Empty array [] means any size is accepted.

Return value - false if error occurred or default value has been used, otherwise true

Used In

Arma3

Example

[1, nil, 2] params ["_var1", "_var2", "_var3"];
// All 3 variables are made private but only _var1 and _var3 are defined

[1, nil, 2] params ["_var1", ["_var2", 23], "_var3"];
// All 3 variables are private and defined
Search OFPEC COMREF