Parameter: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (moved from ArmA: Scripting to Scripting Topics)
No edit summary
Line 12: Line 12:
  _string = _this select 1;
  _string = _this select 1;


<tt>_number</tt> and <tt>_string</tt> are considered the parameters of the script.
<tt>_number</tt> and <tt>_string</tt> are considered the parameters of the script, and are filled with the values that were provided in the array.  <tt>_number</tt> now contains the value '''5''', while _string now contains the value '''string'''.


== See also ==
== See also ==


* [[select]]
* [[Argument]]
* [[Argument]]


[[Category: Scripting Topics]]
[[Category: Scripting Topics]]

Revision as of 00:05, 26 August 2009

A parameter is a value that was passed to the actual script. All parameters (if any) are accessible over the array _this.


Example:

[5, "string"] execVM "script.sqf"


script.sqf

_number = _this select 0;
_string = _this select 1;

_number and _string are considered the parameters of the script, and are filled with the values that were provided in the array. _number now contains the value 5, while _string now contains the value string.

See also