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

reusing struct variable arrays?

Status
Not open for further replies.
Level 17
Joined
Jul 17, 2011
Messages
1,863
JASS:
struct cool
integer c
endstruct 

//===============================

function  d takes nothing returns nothing 
local cool array A
local integer v 
set A[22].c = 40 
set v = A[22].c

can i just reuse this as many times as i want or do i have to allocate it?
for example i wanted to assign the old array a new value
JASS:
A[22].c = 66
after it had a value of 40 is this going to cause any issues?
 
Nope.
Struct arrays do not lose their array values(values before ".")
Its something like this in JASS(simplified)
c[A[22]] = 66
You can actually do something like this:
Cool(8192).c
which converts 8192 to a Cool value.
The local cool array one will lose its value.
Locals only works for the function they are declared.

If you want,its either use allocate/deallocate or create a Struct structure for functions(methods)
 
Status
Not open for further replies.
Top