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

[vJASS] How to refer to an instance created in another funcion?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
Hi, guys, please see the following example, my question is also inside:
JASS:
struct test
    //Suppose this struct has everything needed
endstruct

function CallBack takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local test a = LoadInteger(hash, GetHandleId(t), 0) //Does this make sense?
    //Suppose everything else if fine, can I do the following?
    call a.destroy() // Would this deallocate the instance created in "function example"? 
                     //If not, what should I do? How to refer to the instance created in "function example"? 
endfunction


function example takes nothing returns nothing
    local test a = test.create()
    local timer t = CreateTimer()
    call SaveInteger(hash, GetHandleId(t), 0, a)
    call TimerStart(t, 1, false, function CallBack)
    //Suppose everything else is fine
endfunction

Thanks in advance.
 
Status
Not open for further replies.
Top