Thread: Table 3.1
View Single Post
Old 07-03-2008, 08:24 PM   #13
the-thingy
User
 
Join Date: Feb 2006
Posts: 172

the-thingy will become famous soon enough (30)the-thingy will become famous soon enough (30)

Default

Three questions about this:

1) Must I call t.reset before t.destroy? I don't really understand how GC works :P

2) Do I declare t like local Table t = Table.create ()? If not, how do I do it?

3) Let's say I have a trigger that stores an integer, then recalls it after 5 seconds. If that trigger runs twice within 5 seconds, will I have use a different key for set t[1234567] = GetRandomInt (1, 10) everytime the trigger fires, or will it get the correct value, even if the same key is used for both instances?

Collapse JASS:
function Test takes nothing returns nothing
//See Q2 for the declaration part :P
local integer rnd = GetRandomInt (1, 10)
set t[1] = rnd
call BJDebugMsg (I2S (t[1]))
call TriggerSleepAction (5.)
call BJDebugMsg (I2S (t[1]))

endfunction

If rnd = 5 on first instance, and rnd = 7 on second instance, would my result be (- representing one second of the wait)

5
7
-
-
-
-
-
5
7
the-thingy is offline   Reply With Quote