• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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