OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Ext3rmin4tor on 10 Jan 2009, 12:52:44

Title: Variables in the script language
Post by: Ext3rmin4tor on 10 Jan 2009, 12:52:44
Are all the variables used and defined in the game (of any kind, global or local) pointers? I'm interested in this because I need to know if this code

Code: [Select]
_array1 = [1, 5, 7, 4];
_array2 = _array1;

_array1 = _array1 - [5];

produces as result

array1 = [1, 7, 4]
array2 = [1, 7, 4]

or

array1 = [1, 7, 4]
array2 = [1, 5, 7, 4]

that is, if array2 is a copy of array1 or it is a pointer to the same object of array1.
Title: Re: Variables in the script language
Post by: kju on 10 Jan 2009, 13:47:26
should be in here:
http://community.bistudio.com/wiki/Array
Title: Re: Variables in the script language
Post by: Planck on 10 Jan 2009, 16:15:29
Or even right here at OFPEC:  Array (http://www.ofpec.com/COMREF/index.php?action=read&id=70#Array).

Essentially, array1 and array2 are two variable names that point to the same data (array).
If you change one you change them both.


Planck
Title: Re: Variables in the script language
Post by: Ext3rmin4tor on 10 Jan 2009, 17:30:07
Ok thans, that's what I wanted to know.