[vJASS] Convert int to struct

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
Hi,

If I have an integer array, I can put any struct inside it.

Question is, how do I 'cast' that integer back into the struct it was?

e.g.

JASS:
local integer array foo
local Struct1 a = Struct1.create(...)
local Struct2 b = Struct2.create(...)
set foo[0] = a
set foo[1] = b

Now given foo[0], what do I apply to get back the instance "a"?

Well I think all I need is to invoke the actual integer array storing all instances of Struct1, and just return

JASS:
//this is the integer array keeping track of all instances of Struct1
return struct1Array[foo[0]]

But I have no idea how to access that array or call whatever function does it...
 
Realized the difficulty of that--it would have been an ugly mess of textmacros.

I don't think I'll need this feature anymore though, but I appreciate the helpful answers!
 
Status
Not open for further replies.
Back
Top