Perun 0 Posted October 21, 2009 It would be really nice if we should have some pointer type in Arma 2 scripting. Since a=[1]; b=a; a=[2]; b will result [1] (but as http://community.bistudio.com/wiki/Array (part array references) says it should result [2]) its impossible to make 2 variables work with same memory space. This thing can be very useful and also can much shorten some parts of scripts. Explanation for those who don't exactly know what pointer type should do. Pointer is a variable type which contains address to some other variable (can be also pointer). There is always a function which works with the pointer type and when this function is called with parameter of address (which is saved in pointer) it always return a memory space which is at this address. Example: let's have functions and operations $X - returns memory address of variable x #X - returns memory space at address x X=Y; - assign value y to variable x then A=1; P=$A; #P=5; now A will contain 5 So then if you will create in ofp/arma/ arma 2 some dynamic called variables with call format ["%1_variable = []",a]; you can feel free to do something like this call format ["_b=$%1_variable ",a]; //at this point _b is pointing at your created variable hint #_b; #_b = "test"; instead of call format ["_b=$%1_variable ",a]; call format ["hint %1_variable;",a]; call format ["%1_variable = ""test"";",a]; You can see there is the way with pointers is much easier to take in and there is also less way where to put some mistakes. And in some case if you would have too many of commands where you call "call format xxx" there is also some influence at speed of the script. It depends on how it should be the transposition of address and memory space done by programmer of translator. And also there is much more use for pointers. You can easily make your scripts easy to take in (or inspectional/lucid? translation comment: pÅ™eklad podle slovnÃku ze slova "pÅ™ehledný"). There is also possible to make very complex and easy to use data structures (more complex then arrays in ofp/arma/arma 2 which are really strong tool when correctly used). And when I'm mentioning Arrays - I REALLY MISS function to add value V at position [1,2,3]. For example db set [[1,2,3],V] then db select [1,2,3] (should be same as (((db select 1) select 2) select 2) ) Share this post Link to post Share on other sites
i0n0s 0 Posted November 11, 2009 It would be really nice if we should have some pointer type in Arma 2 scripting. Since a=[1]; b=a; a=[2]; b will result [1] a=[2]; is a new array and not a modification of the old one. Use the set-command. Share this post Link to post Share on other sites
Deadfast 43 Posted November 11, 2009 I just skimmed through your post, but exactly as i0n0s says, your problems can be solved with the set command. That includes adding new index into an already existing array. Share this post Link to post Share on other sites