• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Init Order

Status
Not open for further replies.
I am a bit confused.

JASS:
module M
    static method onInit takes nothing returns nothing
        call BJDebugMsg("M")
        call init()
    endmethod
endmodule

//library A
    struct A
        static method onInit takes nothing returns nothing
            call BJDebugMsg("A")
        endmethod
     
    endstruct
//endlibrary

//library B uses A
    struct B
        static method init takes nothing returns nothing
            call BJDebugMsg("B")
        endmethod
        implement M
    endstruct
//endlibrary

Prints: A M B

Why not: M B A

JPAG - JASS Proper Application Guide -> Initialization Priorities

From .j file

JASS:
//Struct method generated initializers/callers:

function jasshelper__initstructs13685484 takes nothing returns nothing



    call ExecuteFunc("s__A_onInit")
    call ExecuteFunc("s__B_onInit")
endfunction
Isn't this wrong?
 
Level 13
Joined
Nov 7, 2014
Messages
571
static method onInit is not a module initializer
JASS:
module M
    static method onInit takes nothing returns nothing
        call BJDebugMsg("M")
        call init()
    endmethod
endmodule

private static method onInit is a module initializer:
JASS:
module M
    private static method onInit takes nothing returns nothing
        call BJDebugMsg("M")
        call init()
    endmethod
endmodule

Notice the private keyword =)...
JASS:
//Struct method generated initializers/callers:

function jasshelper__initstructs27705122 takes nothing returns nothing


call ExecuteFunc("s__B_M__onInit")

  call ExecuteFunc("s__A_onInit")
endfunction
 
Status
Not open for further replies.
Top