• 🏆 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!

[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