Parameter: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (removed select and used params)
Line 1: Line 1:
A '''parameter''' is a value that ''was passed'' to the actual [[Script (File)|script]]. All parameters (if any) are accessible over the array <tt>_this</tt>.
A '''parameter''' is a value that ''was passed'' to the actual [[Script (File)|script]]. All parameters are accessible over the array <tt>_this</tt>.




Line 9: Line 9:
script.sqf
script.sqf


_number = _this select 0;
[[params]] ["_number","_string"];
_string = _this select 1;


<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'''.
<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'''.
Line 16: Line 15:
== See also ==
== See also ==


* [[params]]
* [[param]]
* [[select]]
* [[select]]
* [[Argument]]
* [[Argument]]


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

Revision as of 12:27, 3 June 2018

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


Example:

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


script.sqf

params ["_number","_string"];

_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