JassHelper 0.9.9.9

AdamGriffith

You can change this now in User CP.
Reaction score
69
Hi,

I was just reading over the manual thing and found this which I didn't understand:

JASS:
Structs

Structs introduce Jass to the object oriented programming paradigm.

I am unable to explain them without making an example first:

struct pair
    integer x
    integer y
endstruct

function testpairs takes nothing returns nothing
 local pair A=pair.create()
    set A.x=5
    set A.x=8

    call BJDebugMsg(I2S(A.x)+" : "+I2S(A.y))

    call pair.destroy(A)

endfunction

As you can see, you can store multiple values in a single struct, then you can just use the struct as if it was another Jass type, notice the . syntax which is used for members on most common languages.


I was wondering wether there was a typo and it should say set A.y = 8 or can you do what he has done?
 

Artificial

Without Intelligence
Reaction score
326
That probably was a typo, but why couldn't you do what he has done? It would just display "8 : 0", wouldn't it?

Edit: Tested it, and yes, that's what it does. :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top