Parameter: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (moved from ArmA: Scripting to Scripting Topics)
m (Some wiki formatting)
 
(5 intermediate revisions by 3 users not shown)
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 {{hl|_this}}.




'''Example:'''
'''Example:'''


[5, "string"] [[execVM]] "script.sqf"
<sqf>[5, "text"] execVM "script.sqf"</sqf>




script.sqf
script.sqf
<sqf>params ["_number","_string"];</sqf>


_number = _this select 0;
{{hl|_number}} and {{hl|_string}} are considered the parameters of the script, and are filled with the values that were provided in the array.  {{hl|_number}} now contains the value '''5''', while _string now contains the value '''string'''.
_string = _this select 1;
 
<tt>_number</tt> and <tt>_string</tt> are considered the parameters of the script.


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


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


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

Latest revision as of 16:40, 22 July 2022

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


Example:

[5, "text"] 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