Drinker 0 Posted June 7, 2003 There's a big problem...it doesn't resize only the selected array, but also all arrays that are equal to that array. Example: _Array1=[2,3,4,5] _Array2=_Array1 _Array1 resize 2 The result is: _Array1=[2,3] _Array2=[2,3] -> why the hell resizes both arrays?? can anybody show how to workaroud this in a simple way? thx Share this post Link to post Share on other sites
RED 0 Posted June 7, 2003 Edit: Denoir solved it RED Share this post Link to post Share on other sites
Guest Posted June 7, 2003 There's a big problem...it doesn't resize only the selected array, but also all arrays that are equal to that array. Example:_Array1=[2,3,4,5] _Array2=_Array1 _Array1 resize 2 The result is: _Array1=[2,3] _Array2=[2,3] -> why the hell resizes both arrays?? can anybody show how to workaroud this in a simple way? thx Arrays are passed by reference. You have to use the unary operator (+). <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Array1=[2,3,4,5] _Array2=+_Array1 _Array1 resize 2 This only works for one level of arrays. If you have arrays within arrays then you have to do a loop and copy the values over. Share this post Link to post Share on other sites
Drinker 0 Posted June 7, 2003 Thx a lot however, i found another way _Array1=[2,3,4,5] _Array2=_Array1 _Array2=_Array2+[] _Array1 resize 2 with +[] the program thinks that the arrays are now different and resizes only the first, i think that this should work also for arrays within arrays cya Share this post Link to post Share on other sites
Guest Posted June 7, 2003 Â Thanks a lot! You've just simplified a lot of my scripts that use matrices! Â Share this post Link to post Share on other sites
Drinker 0 Posted June 7, 2003 you never know, there can always be a better trick to workaround glad to help you cya Share this post Link to post Share on other sites