Structs that extend arrays

saw792

Is known to say things. That is all.
Reaction score
280
How are structs that extend arrays different from regular structs?

For those who don't know what I mean:
JASS:
struct Data extends array
//data

endstruct
 

Viikuna

No Marlo no game.
Reaction score
265
Read JassHelper manual. link


Basicly, you dont create nor destroy them.

Members cant have initial values or array members. ( yet )

They use struct syntax.

They are like arrays that hold more stuff than just one object.

I use them in my DayNightFog system, and they work pretty nicely.

( I just hope that Vexorian adds initial value option soon .. )
 

Artificial

Without Intelligence
Reaction score
326
JASS:

struct Data
    static method operator [] takes integer i returns Data
        return Data(i)
    endmethod
endstruct

(AFAIK) The only difference between this code and the one in the first post is that this one creates destroying and allocating functions.

So basically extends array just makes you able to use [] instead of (). How useful is that. <_<
 

Vexorian

Why no custom sig?
Reaction score
187
So basically extends array just makes you able to use [] instead of (). How useful is that. <_<
Very. End code bloat, prevent people from misusing your struct by calling allocate. Allows your custom allocation. It is not an ugly hack. No crazy typecasts involved. Etc, etc.

And of course:

JASS:
struct meh extends array[12]

   integer x=0
   integer y = 12
endstruct

will work soon (will initialize the arrays for the first 12 indexes)
 

saw792

Is known to say things. That is all.
Reaction score
280
Viikuna said:
I use them in my DayNightFog system, and they work pretty nicely

Yeah that's what reminded me I didn't know what they were, when I saw it in your system.

Anyway, thanks all.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top