• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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