• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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