Home   Help Search Login Register  

Author Topic: Variables in the script language  (Read 1221 times)

0 Members and 1 Guest are viewing this topic.

Offline Ext3rmin4tor

  • Members
  • *
Variables in the script language
« 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.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Variables in the script language
« Reply #2 on: 10 Jan 2009, 16:15:29 »
Or even right here at OFPEC:  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
« Last Edit: 10 Jan 2009, 16:19:47 by Planck »
I know a little about a lot, and a lot about a little.

Offline Ext3rmin4tor

  • Members
  • *
Re: Variables in the script language
« Reply #3 on: 10 Jan 2009, 17:30:07 »
Ok thans, that's what I wanted to know.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!