• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] ExecuteFunc works with methods?

Status
Not open for further replies.
Level 13
Joined
Jan 2, 2016
Messages
973
the function name should look something like LbiraryName_StructName_MethodName.
JASS:
call ExecuteFunc("One_Two_Three")

library One //or scope
struct Two
    real x
    static method Three takes nothing returns nothing
    endmethod
endstruct
endlibrary

Or something like that... not entirely sure how exactly will it look like :p
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
Yeah I'm sure.
JASS:
scope MyScope
    
    
    struct MyStruct
    
        
        static method myMethod1 takes nothing returns nothing
            call BJDebugMsg("ExecuteFunc1 bitch!")
        endmethod
        
        public static method myMethod2 takes nothing returns nothing
            call BJDebugMsg("ExecuteFunc2 bitch!")
        endmethod
   
        private static method myMethod3 takes nothing returns nothing
            call BJDebugMsg("ExecuteFunc3 bitch!")
        endmethod

    endstruct
    
endscope

Call:
JASS:
    call ExecuteFunc("s__MyStruct_myMethod1")
    call ExecuteFunc("s__MyStruct_myMethod2")
    call ExecuteFunc("s__MyStruct_myMethod3")
^All works.

EDIT:
If it's a private struct, you have to call with this:
JASS:
    call ExecuteFunc("s__MyScope__MyStruct_myMethod1")
 
Level 7
Joined
Oct 19, 2015
Messages
286
Or you could use the .name property as it was intended:

call ExecuteFunc( MyStruct.myMethod1.name )

Or, alternatively, call MyStruct.myMethod1.execute()
 
Status
Not open for further replies.
Top