• 🏆 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] Access a method in another struct

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hi guys,

I would like to know how to (if possible) call a method inside a struct from another struct. For example:

JASS:
scope TestScope

    public struct TestData1
        unit caster
        unit target
        
        static method test takes unit u, unit targ returns nothing
            call KillUnit(u)
            call KillUnit(targ)
            set u = null
            set targ = null
        endmethod
    endstruct
    
    private struct TestData2
        unit caster
        unit target
        
        static method test2 takes nothing returns nothing
            local thistype D = thistype.allocate()
            set D.caster = GetTriggerUnit()
            set D.target = GetSpellTargetUnit()
            call TestData1_test(D.caster, D.target) //How to do this part?
            call D.deallocate()
        endmethod
    endstruct

endscope
I know that the above code has no point really, but I'm just using it as an example.

Thanks for any help.
 
Status
Not open for further replies.
Top