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

[JASS] Integer Array

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
How can i see if a Index in a array havnt been used for something like

JASS:
DismishingReturn[H2I(Dat.u)-0x100000]

If i do like

JASS:
if DismishingReturn[H2I(Dat.u)-0x100000] > 0. then

It wont work,i have tried all diffrent stuff but nothing have worked so far :/

I can detect if a unit enter the map and set a value for the unit (effective?).


Or for eg. lets say i make a local integer what value or what ever will it have

JASS:
local integer I = ??
 
Last edited:
Level 4
Joined
May 17, 2008
Messages
75
I think the default value is NaN, Not a Number. This is why:

JASS:
local integer i
set i = i + 1

makes the thread crash. Comparing it as less than, greater than, or equal to anything should always return false.

So, for example, if you know that a variable at a used index may never have a value less than 0 for your purposes,

JASS:
if not (DismishingReturn[H2I(Dat.u)-0x100000] > -1) then

should return true only when the index is unused. (notice the "not".)
 
Status
Not open for further replies.
Top