• 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] 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