Global data?

Discussion in 'JASS Zone' started by Dirac, Jun 15, 2011.

  1. Dirac

    Dirac 22710180

    Ratings:
    +147 / 0 / -0
    hi i was just wondering why does my jasshelper keeps finding an syntax error in this code
    JASS:
    globals
         private data array DATA
    endglobals

    do i need to apply a system to my map in order for this to work?
     
  2. emjlr3

    emjlr3 Change can be a good thing Staff Member

    Ratings:
    +396 / 0 / -0
    what is data?

    is it established as a variable type prior to your global deceleration?
     
  3. Dirac

    Dirac 22710180

    Ratings:
    +147 / 0 / -0
    it should be a variable able to store struct data as in
    JASS:
    local structname A
    set DATA[1] = A


    EDIT: nvm i just figured it out, i have to use a keyword. However im still wondering, why isnt there a variable type able to store struct indexing
     
  4. Rllulium

    Rllulium New Member

    Ratings:
    +10 / 0 / -0
    Struct indexes are integers. (A struct compiles to an array)
     
  5. Sevion

    Sevion The DIY Ninja

    Ratings:
    +423 / 0 / -0
    If you need an array of structs do the following:

    JASS:
    struct myStruct extends array
        implement Alloc // My more efficient allocation and deallocation method that can be found in the Resource Submissions
    
        // Your stuff here
    endstruct
    
    // You can now do things like myStruct data = myStruct.allocate(), data[1].data = 581
     

Share This Page