Results 1 to 2 of 2

Thread: Embarrassed to ask: Global 2D array

  1. #1

    Embarrassed to ask: Global 2D array

    You know how when you declare an array at the top of an LScript that it's globally accessible thoughout the program...

    myVar;



    You know how can promote it to an array with its first use...

    myVar += "dingo";
    myVar += "Harpo";

    etc. and that myVar is now a Global 1D array that was dynamically allocated.



    You know how you dynamically allocate a 2D array in a routine....

    dim1=layerCount;
    dim2=points.size();

    var anotherArray[dim1][dim2];



    Is there a way to dynamically allocate a 2D array that is Global?

    Somewhere, over the rainbow....

  2. #2
    this is Got IT!

    Code:
        testArr;
    
    main
    {    [email protected],2,3,4,[email protected];
         [email protected],7,8,9,10,[email protected];
         [email protected],13,14,15,16,[email protected];
         testArr[1] = a1;
         testArr[2] = a2;
         testArr[2][1]=9;    // just playing with an element
         testArr[3] = a3;
    
        testit();
    }
    
    
    testit {
    
        error(testArr[3][1]);
    }
    DISPLAYS 12 as expected

    Somewhere, over the rainbow....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •